How did I not realize this would loop forever...

This commit is contained in:
GJ 2013-10-18 10:01:59 -04:00
parent 2662fee9fb
commit 2042e0cdbd
3 changed files with 27 additions and 21 deletions

View File

@ -52,12 +52,10 @@ public class CustomArmorConfig extends ConfigLoader {
protected void loadKeys() { protected void loadKeys() {
repairables = new ArrayList<Repairable>(); repairables = new ArrayList<Repairable>();
while (!needsUpdate) {
loadArmor("Boots", customBoots); loadArmor("Boots", customBoots);
loadArmor("Chestplates", customChestplates); loadArmor("Chestplates", customChestplates);
loadArmor("Helmets", customHelmets); loadArmor("Helmets", customHelmets);
loadArmor("Leggings", customLeggings); loadArmor("Leggings", customLeggings);
}
if (needsUpdate) { if (needsUpdate) {
needsUpdate = false; needsUpdate = false;
@ -66,6 +64,10 @@ public class CustomArmorConfig extends ConfigLoader {
} }
private void loadArmor(String armorType, List<Material> materialList) { private void loadArmor(String armorType, List<Material> materialList) {
if (needsUpdate) {
return;
}
ConfigurationSection armorSection = config.getConfigurationSection(armorType); ConfigurationSection armorSection = config.getConfigurationSection(armorType);
if (armorSection == null) { if (armorSection == null) {

View File

@ -43,13 +43,11 @@ public class CustomBlockConfig extends ConfigLoader {
@Override @Override
protected void loadKeys() { protected void loadKeys() {
while (!needsUpdate) {
loadBlocks("Excavation", customExcavationBlocks); loadBlocks("Excavation", customExcavationBlocks);
loadBlocks("Herbalism", customHerbalismBlocks); loadBlocks("Herbalism", customHerbalismBlocks);
loadBlocks("Mining", customMiningBlocks); loadBlocks("Mining", customMiningBlocks);
loadBlocks("Woodcutting", customWoodcuttingBlocks); loadBlocks("Woodcutting", customWoodcuttingBlocks);
loadBlocks("Ability_Blocks", customAbilityBlocks); loadBlocks("Ability_Blocks", customAbilityBlocks);
}
if (needsUpdate) { if (needsUpdate) {
needsUpdate = false; needsUpdate = false;
@ -58,6 +56,10 @@ public class CustomBlockConfig extends ConfigLoader {
} }
private void loadBlocks(String skillType, List<MaterialData> blockList) { private void loadBlocks(String skillType, List<MaterialData> blockList) {
if (needsUpdate) {
return;
}
ConfigurationSection skillSection = config.getConfigurationSection(skillType); ConfigurationSection skillSection = config.getConfigurationSection(skillType);
if (skillSection == null) { if (skillSection == null) {

View File

@ -58,14 +58,12 @@ public class CustomToolConfig extends ConfigLoader {
protected void loadKeys() { protected void loadKeys() {
repairables = new ArrayList<Repairable>(); repairables = new ArrayList<Repairable>();
while (!needsUpdate) {
loadTool("Axes", customAxes); loadTool("Axes", customAxes);
loadTool("Bows", customBows); loadTool("Bows", customBows);
loadTool("Hoes", customHoes); loadTool("Hoes", customHoes);
loadTool("Pickaxes", customPickaxes); loadTool("Pickaxes", customPickaxes);
loadTool("Shovels", customShovels); loadTool("Shovels", customShovels);
loadTool("Swords", customSwords); loadTool("Swords", customSwords);
}
if (needsUpdate) { if (needsUpdate) {
needsUpdate = false; needsUpdate = false;
@ -74,6 +72,10 @@ public class CustomToolConfig extends ConfigLoader {
} }
private void loadTool(String toolType, List<Material> materialList) { private void loadTool(String toolType, List<Material> materialList) {
if (needsUpdate) {
return;
}
ConfigurationSection toolSection = config.getConfigurationSection(toolType); ConfigurationSection toolSection = config.getConfigurationSection(toolType);
if (toolSection == null) { if (toolSection == null) {