From c8c76f41747bf3899652d734889036956d276a5c Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 20 Aug 2013 15:12:38 -0400 Subject: [PATCH] Put this function in a better place. --- .../java/com/gmail/nossr50/config/AdvancedConfig.java | 5 +++-- .../gmail/nossr50/config/AutoUpdateConfigLoader.java | 10 ++++++++++ src/main/java/com/gmail/nossr50/config/Config.java | 2 +- src/main/java/com/gmail/nossr50/util/Misc.java | 8 -------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index f2f806b70..4df3e4ae6 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -780,9 +780,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } // Check if there were any errors - if (Misc.noErrorsInConfig(reason)) { + if (noErrorsInConfig(reason)) { mcMMO.p.debug("No errors found in " + fileName + "!"); - } else { + } + else { mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); mcMMO.p.noErrorsInConfigFiles = false; diff --git a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java index 111a5fecc..9d7e8375f 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java @@ -7,11 +7,13 @@ import java.io.FileWriter; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.metrics.MetricsManager; public abstract class AutoUpdateConfigLoader extends ConfigLoader { @@ -125,4 +127,12 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader { } } } + + protected boolean noErrorsInConfig(List issues) { + for (String issue : issues) { + mcMMO.p.getLogger().warning(issue); + } + + return issues.isEmpty(); + } } diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 49d34c5a5..a153ba69f 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -199,7 +199,7 @@ public class Config extends AutoUpdateConfigLoader { } // Check if there were any errors - if (Misc.noErrorsInConfig(reason)) { + if (noErrorsInConfig(reason)) { mcMMO.p.debug("No errors found in " + fileName + "!"); } else { diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 448995c23..f0e68db8a 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -302,14 +302,6 @@ public final class Misc { return partialName; } - public static boolean noErrorsInConfig(List issues) { - for (String issue : issues) { - mcMMO.p.getLogger().warning(issue); - } - - return issues.isEmpty(); - } - public static Random getRandom() { return random; }