Improve version detect
This commit is contained in:
parent
debb421e38
commit
a763850f11
1 changed files with 18 additions and 3 deletions
|
|
@ -11,12 +11,27 @@ public class MinecraftReflectionVersion {
|
|||
|
||||
static {
|
||||
String bukkitPackage = Bukkit.getServer().getClass().getPackage().getName();
|
||||
NMS = bukkitPackage.substring(bukkitPackage.lastIndexOf('.') + 1);
|
||||
String nms = bukkitPackage.substring(bukkitPackage.lastIndexOf('.') + 1);
|
||||
|
||||
String[] split = NMS.split("_");
|
||||
if (nms.contains("_")) {
|
||||
NMS = nms;
|
||||
} else {
|
||||
NMS = "";
|
||||
}
|
||||
|
||||
/*String[] split = NMS.split("_");
|
||||
MAJOR = Integer.parseInt(split[0].substring(1));
|
||||
MINOR = Integer.parseInt(split[1]);
|
||||
PATCH = Integer.parseInt(split[2].substring(1, 2));
|
||||
PATCH = Integer.parseInt(split[2].substring(1, 2));*/
|
||||
|
||||
String version = Bukkit.getVersion();
|
||||
version = version.substring(version.indexOf("(MC: ") + 5, version.length() - 1);
|
||||
|
||||
String[] versionParts = version.split("\\.");
|
||||
|
||||
MAJOR = Integer.parseInt(versionParts[0]);
|
||||
MINOR = Integer.parseInt(versionParts[1]);
|
||||
PATCH = versionParts.length > 2 ? Integer.parseInt(versionParts[2]) : 0;
|
||||
}
|
||||
|
||||
public static boolean is(int minor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue