From 6330c4a69eedd508ffbc62aaa7c362bfe9f1d2f7 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Fri, 9 Aug 2013 19:10:03 +0200 Subject: [PATCH] Move the noErrorsInConfig check to Misc --- .../java/com/gmail/nossr50/config/AdvancedConfig.java | 11 ++--------- src/main/java/com/gmail/nossr50/config/Config.java | 11 ++--------- src/main/java/com/gmail/nossr50/util/Misc.java | 8 ++++++++ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 5e852ecfa..1ad6d00b0 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.Misc; public class AdvancedConfig extends AutoUpdateConfigLoader { private static AdvancedConfig instance; @@ -771,7 +772,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } // Check if there were any errors - if (noErrorsInConfig(reason)) { + if (Misc.noErrorsInConfig(reason)) { mcMMO.p.debug("No errors found in " + fileName + "!"); } else { mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); @@ -1050,12 +1051,4 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", "You have escaped from the kraken!"); } public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); } public int getKrakenAttackDamage() { return config.getInt("Kraken.Attack_Damage", 1); } - - private boolean noErrorsInConfig(List issues) {//TODO move this to misc - for (String issue : issues) { - plugin.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 fb973e296..95a658419 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -12,6 +12,7 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.StringUtils; public class Config extends AutoUpdateConfigLoader { @@ -201,7 +202,7 @@ public class Config extends AutoUpdateConfigLoader { } // Check if there were any errors - if (noErrorsInConfig(reason)) { + if (Misc.noErrorsInConfig(reason)) { mcMMO.p.debug("No errors found in " + fileName + "!"); } else { mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); @@ -489,12 +490,4 @@ public class Config extends AutoUpdateConfigLoader { public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); } public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience.Formula.Cumulative_Curve", false); } public double getFormulaSkillModifier(SkillType skill) { return config.getDouble("Experience.Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); } - - private boolean noErrorsInConfig(List issues) { - for (String issue : issues) { - plugin.getLogger().warning(issue); - } - - return issues.isEmpty(); - } } diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index fd6b7daa4..4de85bff0 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -261,6 +261,14 @@ public final class Misc { return ((Furnace) furnaceState).getInventory().getResult(); } + public static boolean noErrorsInConfig(List issues) { + for (String issue : issues) { + mcMMO.p.getLogger().warning(issue); + } + + return issues.isEmpty(); + } + public static Random getRandom() { return random; }