Merge branch 'master' into develop

This commit is contained in:
Maxlego08 2024-06-24 09:42:32 +02:00
commit 3aa2831ffe
3 changed files with 35 additions and 23 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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,7 +12,7 @@ public class NMSUtils {
} }
/** /**
* Get minecraft serveur version * Get minecraft server version
* *
* @return version * @return version
*/ */
@ -19,10 +20,21 @@ public class NMSUtils {
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("_");
if (versionParts.length >= 2) {
String var2 = versionParts[0].replace("v", "");
String var3 = versionParts[1];
return version = Double.parseDouble(var2 + "." + var3); 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
}
} }
/** /**
@ -37,7 +49,7 @@ 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,7 +58,7 @@ public class NMSUtils {
} }
/** /**
* check if version is granther than 1.13 * Check if version is greater than 1.13
* *
* @return boolean * @return boolean
*/ */
@ -93,7 +105,7 @@ public class NMSUtils {
/** /**
* *
* Check if server vesion is new version * Check if server version is new version
* *
* @return boolean * @return boolean
*/ */