From ccff8bc6dccecac0b42aea6a936e068f753a1235 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 9 Feb 2021 16:23:42 +1300 Subject: [PATCH] Try detect more reloads --- .../java/me/libraryaddict/disguise/LibsDisguises.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index fce5b5d6..8f3b8997 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -59,14 +59,14 @@ public class LibsDisguises extends JavaPlugin { @Override public void onLoad() { - instance = this; - - if (!Bukkit.getServer().getWorlds().isEmpty()) { + if (instance != null || !Bukkit.getServer().getWorlds().isEmpty() || !Bukkit.getOnlinePlayers().isEmpty()) { reloaded = true; getLogger().severe("Server was reloaded! Please do not report any bugs! This plugin can't handle " + "reloads gracefully!"); return; } + instance = this; + Plugin plugin = Bukkit.getPluginManager().getPlugin("ProtocolLib"); if (plugin == null || DisguiseUtilities.isOlderThan(DisguiseUtilities.getProtocolLibRequiredVersion(), plugin.getDescription().getVersion())) { @@ -286,6 +286,8 @@ public class LibsDisguises extends JavaPlugin { for (Player player : Bukkit.getOnlinePlayers()) { DisguiseUtilities.removeSelfDisguiseScoreboard(player); } + + reloaded = true; } public boolean isReleaseBuild() {