mirror of
https://github.com/Maxlego08/zKoth.git
synced 2024-11-22 11:55:12 +01:00
Merge branch 'master' into develop
This commit is contained in:
commit
3aa2831ffe
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fr.maxlego08.koth</groupId>
|
<groupId>fr.maxlego08.koth</groupId>
|
||||||
<artifactId>zKoth</artifactId>
|
<artifactId>zKoth</artifactId>
|
||||||
<version>3.0.7</version>
|
<version>3.0.8</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fr.maxlego08.koth</groupId>
|
<groupId>fr.maxlego08.koth</groupId>
|
||||||
<artifactId>zKoth</artifactId>
|
<artifactId>zKoth</artifactId>
|
||||||
<version>3.0.7</version>
|
<version>3.0.8</version>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package fr.maxlego08.koth.zcore.utils.nms;
|
package fr.maxlego08.koth.zcore.utils.nms;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import fr.maxlego08.koth.zcore.logger.Logger;
|
||||||
|
|
||||||
public class NMSUtils {
|
public class NMSUtils {
|
||||||
|
|
||||||
@ -11,23 +12,34 @@ public class NMSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get minecraft serveur version
|
* Get minecraft server version
|
||||||
*
|
*
|
||||||
* @return version
|
* @return version
|
||||||
*/
|
*/
|
||||||
public static double getNMSVersion() {
|
public static double getNMSVersion() {
|
||||||
if (version != 0)
|
if (version != 0)
|
||||||
return version;
|
return version;
|
||||||
String var1 = Bukkit.getServer().getClass().getPackage().getName();
|
String var1 = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
String[] arrayOfString = var1.replace(".", ",").split(",")[3].split("_");
|
String[] arrayOfString = var1.replace(".", ",").split(",");
|
||||||
String var2 = arrayOfString[0].replace("v", "");
|
if (arrayOfString.length > 3) {
|
||||||
String var3 = arrayOfString[1];
|
String[] versionParts = arrayOfString[3].split("_");
|
||||||
return version = Double.parseDouble(var2 + "." + var3);
|
if (versionParts.length >= 2) {
|
||||||
|
String var2 = versionParts[0].replace("v", "");
|
||||||
|
String var3 = versionParts[1];
|
||||||
|
return version = Double.parseDouble(var2 + "." + var3);
|
||||||
|
} else {
|
||||||
|
Logger.info("Unexpected NMS version format: " + var1);
|
||||||
|
return version = 0; // default to 0 if the format is unexpected
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Logger.info("Unexpected NMS version format: " + var1);
|
||||||
|
return version = 0; // default to 0 if the format is unexpected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if minecraft version has shulker
|
* Check if minecraft version has shulker
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean hasShulker() {
|
public static boolean hasShulker() {
|
||||||
@ -36,8 +48,8 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if minecraft version has barrel
|
* Check if minecraft version has barrel
|
||||||
*
|
*
|
||||||
* @return booleab
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean hasBarrel() {
|
public static boolean hasBarrel() {
|
||||||
final double version = getNMSVersion();
|
final double version = getNMSVersion();
|
||||||
@ -46,8 +58,8 @@ public class NMSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if version is granther than 1.13
|
* Check if version is greater than 1.13
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isNewVersion() {
|
public static boolean isNewVersion() {
|
||||||
@ -56,7 +68,7 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if version has one hand
|
* Check if version has one hand
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isOneHand() {
|
public static boolean isOneHand() {
|
||||||
@ -65,7 +77,7 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check is version is minecraft 1.7
|
* Check is version is minecraft 1.7
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isVeryOldVersion() {
|
public static boolean isVeryOldVersion() {
|
||||||
@ -74,7 +86,7 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if version has itemmeta unbreakable
|
* Check if version has itemmeta unbreakable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isUnbreakable() {
|
public static boolean isUnbreakable() {
|
||||||
@ -83,7 +95,7 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if version is old version of minecraft with old material system
|
* Check if version is old version of minecraft with old material system
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isOldVersion() {
|
public static boolean isOldVersion() {
|
||||||
@ -92,9 +104,9 @@ public class NMSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Check if server vesion is new version
|
* Check if server version is new version
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isNewNMSVersion() {
|
public static boolean isNewNMSVersion() {
|
||||||
@ -104,9 +116,9 @@ public class NMSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Check if server version is new version
|
* Check if server version is new version
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isNewNBTVersion() {
|
public static boolean isNewNBTVersion() {
|
||||||
@ -118,7 +130,7 @@ public class NMSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows to check if the version has the colors in hex
|
* Allows to check if the version has the colors in hex
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isHexColor() {
|
public static boolean isHexColor() {
|
||||||
|
Loading…
Reference in New Issue
Block a user