Skip to content

Commit

Permalink
Fix Skript MinecraftServer.isRunning reflection on 1.20(.1) (SkriptLa…
Browse files Browse the repository at this point in the history
  • Loading branch information
C0D3-M4513R authored and ShaneBeee committed Feb 2, 2024
1 parent f581395 commit 03ac201
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/ch/njol/skript/Skript.java
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,15 @@ public void onPluginDisable(PluginDisableEvent event) {
try {
// Spigot removed the mapping for this method in 1.18, so its back to obfuscated method
// 1.19 mapping is u and 1.18 is v
String isRunningMethod = Skript.isRunningMinecraft(1, 19) ? "u" : Skript.isRunningMinecraft(1, 18) ? "v" :"isRunning";
String isRunningMethod = "isRunning";

if (Skript.isRunningMinecraft(1, 20)) {
isRunningMethod = "v";
} else if (Skript.isRunningMinecraft(1, 19)) {
isRunningMethod = "u";
} else if (Skript.isRunningMinecraft(1, 18)) {
isRunningMethod = "v";
}
IS_RUNNING = MC_SERVER.getClass().getMethod(isRunningMethod);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 03ac201

Please sign in to comment.