From 0c12677c4254137519a1764c58426f9d703fae50 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 5 Jun 2024 06:00:23 -0700 Subject: [PATCH] Fix version parsing --- .../dev/magicmq/pyspigot/util/ReflectionUtils.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/magicmq/pyspigot/util/ReflectionUtils.java b/src/main/java/dev/magicmq/pyspigot/util/ReflectionUtils.java index a825b1a..ffa6037 100644 --- a/src/main/java/dev/magicmq/pyspigot/util/ReflectionUtils.java +++ b/src/main/java/dev/magicmq/pyspigot/util/ReflectionUtils.java @@ -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() {}