fix: 修复Minecraft版本大于1.16时NMS包获取错误的问题

This commit is contained in:
2024-03-17 09:34:47 +08:00
parent fd4f25b3d3
commit 5d6a11d9b0

View File

@@ -61,11 +61,13 @@ public class MinecraftVersion {
@NotNull @NotNull
public static Class<?> getNMSClass(@NotNull String className) throws ClassNotFoundException { public static Class<?> getNMSClass(@NotNull String className) throws ClassNotFoundException {
if (Version2 >= 17) {
return Class.forName("net.minecraft.server." + className);
}
String nmsVersion = getNMSVersion(); String nmsVersion = getNMSVersion();
return Class.forName("net.minecraft.server." + nmsVersion + "." + className); return Class.forName("net.minecraft.server." + nmsVersion + "." + className);
} }
@NotNull @NotNull
public static Class<?> getNMSClassSilent(@NotNull String className) { public static Class<?> getNMSClassSilent(@NotNull String className) {
String nmsVersion = getNMSVersion(); String nmsVersion = getNMSVersion();