From 7fcd90a3384deddb61c75cce1536e0c3184e8134 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 20 Feb 2020 12:11:22 +1300 Subject: [PATCH] Move asm to onLoad just incase other plugins are weird loading --- .../java/me/libraryaddict/disguise/LibsDisguises.java | 2 +- .../disguise/utilities/reflection/ReflectionManager.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index 342252cb..489ba622 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -31,6 +31,7 @@ public class LibsDisguises extends JavaPlugin { @Override public void onLoad() { if (Bukkit.getServer().getWorlds().isEmpty()) { + WatcherSanitizer.init(); return; } @@ -79,7 +80,6 @@ public class LibsDisguises extends JavaPlugin { return; } - WatcherSanitizer.init(); ReflectionManager.init(); PacketsManager.init(); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index 1bc59569..8de906d6 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -55,7 +55,6 @@ public class ReflectionManager { private static Field trackerField; @NmsRemovedIn(val = NmsVersion.v1_14) private static Field entitiesField; - @Getter private static NmsVersion version; public static void init() { @@ -360,6 +359,14 @@ public class ReflectionManager { return null; } + public static NmsVersion getVersion() { + if (version == null) { + getBukkitVersion(); + } + + return version; + } + public static String getBukkitVersion() { if (bukkitVersion == null) { bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3];