These were basically the same function.

This commit is contained in:
GJ 2013-08-20 15:15:42 -04:00
parent c8c76f4174
commit 045d74fb9d
5 changed files with 13 additions and 24 deletions

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
public class AdvancedConfig extends AutoUpdateConfigLoader { public class AdvancedConfig extends AutoUpdateConfigLoader {
private static AdvancedConfig instance; private static AdvancedConfig instance;

View File

@ -7,13 +7,11 @@ import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metrics.MetricsManager; import com.gmail.nossr50.metrics.MetricsManager;
public abstract class AutoUpdateConfigLoader extends ConfigLoader { public abstract class AutoUpdateConfigLoader extends ConfigLoader {
@ -127,12 +125,4 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
} }
} }
} }
protected boolean noErrorsInConfig(List<String> issues) {
for (String issue : issues) {
mcMMO.p.getLogger().warning(issue);
}
return issues.isEmpty();
}
} }

View File

@ -13,7 +13,6 @@ import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.repair.RepairMaterialType; import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
public class Config extends AutoUpdateConfigLoader { public class Config extends AutoUpdateConfigLoader {

View File

@ -6,6 +6,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -90,4 +91,12 @@ public abstract class ConfigLoader {
} }
} }
} }
protected boolean noErrorsInConfig(List<String> issues) {
for (String issue : issues) {
plugin.getLogger().warning(issue);
}
return issues.isEmpty();
}
} }

View File

@ -188,7 +188,7 @@ public class TreasureConfig extends ConfigLoader {
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level"); int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
if (noErrorsInTreasure(reason)) { if (noErrorsInConfig(reason)) {
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel); FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
treasures.put(treasureName, fTreasure); treasures.put(treasureName, fTreasure);
} }
@ -212,7 +212,7 @@ public class TreasureConfig extends ConfigLoader {
reason.add("Invalid Mob: " + mobType); reason.add("Invalid Mob: " + mobType);
} }
if (noErrorsInTreasure(reason)) { if (noErrorsInConfig(reason)) {
ShakeTreasure sTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel, mob); ShakeTreasure sTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel, mob);
treasures.put(treasureName, sTreasure); treasures.put(treasureName, sTreasure);
} }
@ -273,10 +273,10 @@ public class TreasureConfig extends ConfigLoader {
reason.add("This cannot also be a shake drop."); 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); treasures.put(treasureName, eTreasure);
} }
else if (noErrorsInTreasure(reason) && eTreasure.getDropsFrom() == (byte) 0x0) { else if (noErrorsInConfig(reason) && eTreasure.getDropsFrom() == (byte) 0x0) {
treasures.put(treasureName, hTreasure); treasures.put(treasureName, hTreasure);
} }
} }
@ -449,12 +449,4 @@ public class TreasureConfig extends ConfigLoader {
} }
} }
} }
private boolean noErrorsInTreasure(List<String> issues) {
for (String issue : issues) {
plugin.getLogger().warning(issue);
}
return issues.isEmpty();
}
} }