Modify custom items loading to permit registering of repairables from these configs.

Move loading of the main repairables to below the custom items so that repair.*.yml will over-write any custom items when the list is processed and repairables registered.
This commit is contained in:
NuclearW
2012-05-22 07:56:48 -04:00
parent 9546cc42b2
commit 0a15cb1e13
3 changed files with 28 additions and 5 deletions

View File

@@ -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<Repairable> repairables = rManager.getLoadedRepairables();
repairManager = RepairManagerFactory.getRepairManager(repairables.size());
repairManager.registerRepairables(repairables);
List<Repairable> repairables = new ArrayList<Repairable>();
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();
}