9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

Improve cartography table

This commit is contained in:
XiaoMoMi
2025-02-13 21:18:27 +08:00
parent 3454a3de5a
commit d8423cf137
6 changed files with 78 additions and 23 deletions

View File

@@ -4,12 +4,14 @@ public class VersionHelper {
private static float version;
private static boolean mojmap;
private static boolean folia;
private static boolean paper;
public static void init(String serverVersion) {
String[] split = serverVersion.split("\\.");
version = Float.parseFloat(split[1] + "." + (split.length == 3 ? split[2] : "0"));
checkMojMap();
checkFolia();
checkPaper();
}
public static float version() {
@@ -33,6 +35,14 @@ public class VersionHelper {
}
}
private static void checkPaper() {
try {
Class.forName("io.papermc.paper.adventure.PaperAdventure");
paper = true;
} catch (ClassNotFoundException ignored) {
}
}
public static boolean isFolia() {
return folia;
}
@@ -80,4 +90,8 @@ public class VersionHelper {
public static boolean isVersionNewerThan1_20_3() {
return version >= 20.29f;
}
public static boolean isPaper() {
return paper;
}
}