From b460f7a56446eb9684c349998369ecb9f2a7edd1 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sat, 18 Jan 2014 16:58:49 +0100 Subject: [PATCH] Add more debug messages in onDisable() So that we can track down why the disable proces slows down --- src/main/java/com/gmail/nossr50/mcMMO.java | 2 ++ src/main/java/com/gmail/nossr50/party/PartyManager.java | 1 + src/main/java/com/gmail/nossr50/util/HolidayManager.java | 1 + .../com/gmail/nossr50/util/experience/FormulaManager.java | 1 + src/main/java/com/gmail/nossr50/util/player/UserManager.java | 1 + .../com/gmail/nossr50/util/scoreboards/ScoreboardManager.java | 4 +++- 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 5191a0e72..1fef76fe1 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -211,7 +211,9 @@ public class mcMMO extends JavaPlugin { } catch (NullPointerException e) {} + debug("Canceling all tasks..."); getServer().getScheduler().cancelTasks(this); // This removes our tasks + debug("Unregister all events..."); HandlerList.unregisterAll(this); // Cancel event registrations if (Config.getInstance().getBackupsEnabled()) { diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index ba1d38b06..4ca927335 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -526,6 +526,7 @@ public final class PartyManager { YamlConfiguration partiesFile = new YamlConfiguration(); + mcMMO.p.debug("Saving Parties... (" + parties.size() + ")"); for (Party party : parties) { String partyName = party.getName(); diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index a3255e700..ec7b97638 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -134,6 +134,7 @@ public final class HolidayManager { // This gets called onDisable public void saveAnniversaryFiles() { + mcMMO.p.debug("Saving anniversary files..."); String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + CURRENT_YEAR + ".yml"; try { diff --git a/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java b/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java index f8baba046..22bf1fe61 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java +++ b/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java @@ -151,6 +151,7 @@ public class FormulaManager { * Save formula file. */ public void saveFormula() { + mcMMO.p.debug("Saving previous XP formula type..."); YamlConfiguration formulasFile = new YamlConfiguration(); formulasFile.set("Previous_Formula", previousFormula.toString()); diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java index 4776a0026..b409eb1ec 100644 --- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -57,6 +57,7 @@ public final class UserManager { * Save all users. */ public static void saveAll() { + mcMMO.p.debug("Saving mcMMOPlayers... (" + players.size() + ")"); for (McMMOPlayer mcMMOPlayer : players.values()) { mcMMOPlayer.getProfile().save(); } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index 1b0d35773..fd62d582f 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -161,7 +161,9 @@ public class ScoreboardManager { // Called in onDisable() public static void teardownAll() { - for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { + Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers(); + mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.length + ")"); + for (Player player : onlinePlayers) { teardownPlayer(player); } }