bump nms for 1.21.8 support

This commit is contained in:
Julian Krings 2025-07-19 12:59:50 +02:00
parent d49f7d7821
commit a8892b04ef
No known key found for this signature in database
GPG Key ID: 208C6E08C3B718D2
2 changed files with 21 additions and 18 deletions

View File

@ -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<String, String> 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<Version> 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<Version> 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<Version> 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) {}

View File

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