diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java index 5a43acf59..5b3948354 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.mods.CustomItem; +import com.gmail.nossr50.skills.repair.Repairable; public class CustomArmorConfig extends ModConfigLoader{ private static CustomArmorConfig instance; @@ -23,6 +24,8 @@ public class CustomArmorConfig extends ModConfigLoader{ return instance; } + private List repairables; + public List customBootIDs = new ArrayList(); public List customChestplateIDs = new ArrayList(); public List customHelmetIDs = new ArrayList(); @@ -51,6 +54,7 @@ public class CustomArmorConfig extends ModConfigLoader{ @Override protected void loadKeys() { plugin.getLogger().info("Loading mcMMO armor.yml File..."); + repairables = new ArrayList(); loadArmor("Boots", customBootIDs); loadArmor("Chestplates", customChestplateIDs); @@ -99,4 +103,9 @@ public class CustomArmorConfig extends ModConfigLoader{ customArmor.put(id, armor); } } + + public List getLoadedRepairables() { + if(repairables == null) return new ArrayList(); + return repairables; + } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java index 5db742e99..dbde446fb 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.mods.CustomTool; +import com.gmail.nossr50.skills.repair.Repairable; public class CustomToolsConfig extends ModConfigLoader { private static CustomToolsConfig instance; @@ -23,6 +24,8 @@ public class CustomToolsConfig extends ModConfigLoader { return instance; } + private List repairables; + public List customAxeIDs = new ArrayList(); public List customBowIDs = new ArrayList(); public List customHoeIDs = new ArrayList(); @@ -53,6 +56,7 @@ public class CustomToolsConfig extends ModConfigLoader { @Override protected void loadKeys() { plugin.getLogger().info("Loading mcMMO tools.yml File..."); + repairables = new ArrayList(); loadTool("Axes", customAxeIDs); loadTool("Bows", customBowIDs); @@ -106,4 +110,9 @@ public class CustomToolsConfig extends ModConfigLoader { customTools.put(id, tool); } } + + public List getLoadedRepairables() { + if(repairables == null) return new ArrayList(); + return repairables; + } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 981a93e63..1240d5a7f 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -36,6 +36,7 @@ import net.shatteredlands.shatt.backup.ZipLibrary; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -84,24 +85,28 @@ public class mcMMO extends JavaPlugin { TreasuresConfig.getInstance(); HiddenConfig.getInstance(); - //Load repair configs and register them - RepairConfigManager rManager = new RepairConfigManager(this); - List repairables = rManager.getLoadedRepairables(); - repairManager = RepairManagerFactory.getRepairManager(repairables.size()); - repairManager.registerRepairables(repairables); + List repairables = new ArrayList(); if (configInstance.getToolModsEnabled()) { CustomToolsConfig.getInstance().load(); + repairables.addAll(CustomToolsConfig.getInstance().getLoadedRepairables()); } if (configInstance.getArmorModsEnabled()) { CustomArmorConfig.getInstance().load(); + repairables.addAll(CustomArmorConfig.getInstance().getLoadedRepairables()); } if (configInstance.getBlockModsEnabled()) { CustomBlocksConfig.getInstance().load(); } + //Load repair configs, make manager, and register them at this time + RepairConfigManager rManager = new RepairConfigManager(this); + repairables.addAll(rManager.getLoadedRepairables()); + repairManager = RepairManagerFactory.getRepairManager(repairables.size()); + repairManager.registerRepairables(repairables); + if (!configInstance.getUseMySQL()) { Users.loadUsers(); }