Skip to content

Commit

Permalink
Fix version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
virustotalop committed Jun 5, 2024
1 parent 7509994 commit 0c12677
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/main/java/dev/magicmq/pyspigot/util/ReflectionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ public final class ReflectionUtils {
private static final String MC_VERSION;

static {
Server server = Bukkit.getServer();
Class<?> serverClass = server.getClass();
Method getMinecraftVersion = getMethod(serverClass, "getMinecraftVersion");
try {
MC_VERSION = getMinecraftVersion != null ?
(String) getMinecraftVersion.invoke(server) :
serverClass.getPackage().getName().split("\\.")[3];
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
String[] split = Bukkit.getServer().getClass().getPackage().getName().split("\\.");
MC_VERSION = split.length >= 4 ? split[3] : "";
}

private ReflectionUtils() {}
Expand Down

0 comments on commit 0c12677

Please sign in to comment.