diff --git a/core/src/main/java/com/volmit/iris/core/nms/INMS.java b/core/src/main/java/com/volmit/iris/core/nms/INMS.java index 8b998147c..e4d6bc682 100644 --- a/core/src/main/java/com/volmit/iris/core/nms/INMS.java +++ b/core/src/main/java/com/volmit/iris/core/nms/INMS.java @@ -24,21 +24,21 @@ import com.volmit.iris.core.nms.v1X.NMSBinding1X; import org.bukkit.Bukkit; import java.util.List; -import java.util.Map; public class INMS { - private static final Map REVISION = Map.of( - "1.20.5", "v1_20_R4", - "1.20.6", "v1_20_R4", - "1.21", "v1_21_R1", - "1.21.1", "v1_21_R1", - "1.21.2", "v1_21_R2", - "1.21.3", "v1_21_R2", - "1.21.4", "v1_21_R3", - "1.21.5", "v1_21_R4", - "1.21.6", "v1_21_R5", - "1.21.7", "v1_21_R5" + private static final Version CURRENT = Boolean.getBoolean("iris.no-version-limit") ? + new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, null) : + new Version(21, 8, null); + + private static final List REVISION = List.of( + new Version(21, 6, "v1_21_R5"), + new Version(21, 5, "v1_21_R4"), + new Version(21, 4, "v1_21_R3"), + new Version(21, 2, "v1_21_R2"), + new Version(21, 0, "v1_21_R1"), + new Version(20, 5, "v1_20_R4") ); + private static final List PACKS = List.of( new Version(21, 5, "31100"), new Version(21, 4, "31020"), @@ -48,7 +48,7 @@ public class INMS { //@done private static final INMSBinding binding = bind(); - public static final String OVERWORLD_TAG = getOverworldTag(); + public static final String OVERWORLD_TAG = getTag(PACKS, "3910"); public static INMSBinding get() { return binding; @@ -62,7 +62,7 @@ public class INMS { try { String name = Bukkit.getServer().getClass().getCanonicalName(); if (name.equals("org.bukkit.craftbukkit.CraftServer")) { - return REVISION.getOrDefault(Bukkit.getServer().getBukkitVersion().split("-")[0], "BUKKIT"); + return getTag(REVISION, "BUKKIT"); } else { return name.split("\\Q.\\E")[3]; } @@ -100,7 +100,7 @@ public class INMS { return new NMSBinding1X(); } - private static String getOverworldTag() { + private static String getTag(List versions, String def) { var version = Bukkit.getServer().getBukkitVersion().split("-")[0].split("\\.", 3); int major = 0; int minor = 0; @@ -111,13 +111,16 @@ public class INMS { } else if (version.length == 2) { major = Integer.parseInt(version[1]); } + if (CURRENT.major < major || CURRENT.minor < minor) { + return versions.getFirst().tag; + } - for (var p : PACKS) { + for (var p : versions) { if (p.major > major || p.minor > minor) continue; return p.tag; } - return "3910"; + return def; } private record Version(int major, int minor, String tag) {} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bdc075162..f697c836e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ [versions] # Plugins shadow = "9.0.0-rc1" # https://plugins.gradle.org/plugin/com.gradleup.shadow -slimjar = "2.0.7" # https://plugins.gradle.org/plugin/de.crazydev22.slimjar +slimjar = "2.0.8" # https://plugins.gradle.org/plugin/de.crazydev22.slimjar download = "5.6.0" # https://plugins.gradle.org/plugin/de.undercouch.download runPaper = "2.3.1" # https://plugins.gradle.org/plugin/xyz.jpenilla.run-paper sentryPlugin = "5.8.0" # https://github.com/getsentry/sentry-android-gradle-plugin