From 045d74fb9dafe096b687cacaf7fe5998d7812a04 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 20 Aug 2013 15:15:42 -0400 Subject: [PATCH] These were basically the same function. --- .../com/gmail/nossr50/config/AdvancedConfig.java | 1 - .../nossr50/config/AutoUpdateConfigLoader.java | 10 ---------- .../java/com/gmail/nossr50/config/Config.java | 1 - .../com/gmail/nossr50/config/ConfigLoader.java | 9 +++++++++ .../nossr50/config/treasure/TreasureConfig.java | 16 ++++------------ 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 4df3e4ae6..7c95cf799 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -4,7 +4,6 @@ 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; diff --git a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java index 9d7e8375f..111a5fecc 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java @@ -7,13 +7,11 @@ 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 { @@ -127,12 +125,4 @@ 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 a153ba69f..c81ee6c15 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -13,7 +13,6 @@ import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.skills.repair.RepairMaterialType; -import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.StringUtils; public class Config extends AutoUpdateConfigLoader { diff --git a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java index d5f68004a..e06415269 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java @@ -6,6 +6,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.List; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -90,4 +91,12 @@ public abstract class ConfigLoader { } } } + + protected boolean noErrorsInConfig(List issues) { + for (String issue : issues) { + plugin.getLogger().warning(issue); + } + + return issues.isEmpty(); + } } diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index bf2bd655e..ad3de832c 100644 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -188,7 +188,7 @@ public class TreasureConfig extends ConfigLoader { int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level"); - if (noErrorsInTreasure(reason)) { + if (noErrorsInConfig(reason)) { FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel); treasures.put(treasureName, fTreasure); } @@ -212,7 +212,7 @@ public class TreasureConfig extends ConfigLoader { reason.add("Invalid Mob: " + mobType); } - if (noErrorsInTreasure(reason)) { + if (noErrorsInConfig(reason)) { ShakeTreasure sTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel, mob); treasures.put(treasureName, sTreasure); } @@ -273,10 +273,10 @@ public class TreasureConfig extends ConfigLoader { reason.add("This cannot also be a shake drop."); } - if (noErrorsInTreasure(reason) && hTreasure.getDropsFrom() == (byte) 0x0) { + if (noErrorsInConfig(reason) && hTreasure.getDropsFrom() == (byte) 0x0) { treasures.put(treasureName, eTreasure); } - else if (noErrorsInTreasure(reason) && eTreasure.getDropsFrom() == (byte) 0x0) { + else if (noErrorsInConfig(reason) && eTreasure.getDropsFrom() == (byte) 0x0) { treasures.put(treasureName, hTreasure); } } @@ -449,12 +449,4 @@ public class TreasureConfig extends ConfigLoader { } } } - - private boolean noErrorsInTreasure(List issues) { - for (String issue : issues) { - plugin.getLogger().warning(issue); - } - - return issues.isEmpty(); - } }