Remove RepairableManagerFactory until we actually need it

Let's hold off on the factory pattern until we actually offer choices.
This commit is contained in:
riking 2013-10-08 21:10:32 -07:00 committed by TfT_02
parent 766f1f4127
commit 476f426590
3 changed files with 4 additions and 18 deletions

View File

@ -38,7 +38,7 @@ import com.gmail.nossr50.skills.child.ChildConfig;
import com.gmail.nossr50.skills.repair.config.RepairConfigManager; import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableManager; import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
import com.gmail.nossr50.skills.repair.repairables.RepairableManagerFactory; import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
import com.gmail.nossr50.util.ChimaeraWing; import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.LogFilter; import com.gmail.nossr50.util.LogFilter;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@ -357,7 +357,7 @@ public class mcMMO extends JavaPlugin {
// Load repair configs, make manager, and register them at this time // Load repair configs, make manager, and register them at this time
RepairConfigManager rManager = new RepairConfigManager(this); RepairConfigManager rManager = new RepairConfigManager(this);
repairables.addAll(rManager.getLoadedRepairables()); repairables.addAll(rManager.getLoadedRepairables());
repairableManager = RepairableManagerFactory.getRepairManager(repairables.size()); repairableManager = new SimpleRepairableManager(repairables.size());
repairableManager.registerRepairables(repairables); repairableManager.registerRepairables(repairables);
} }

View File

@ -1,14 +0,0 @@
package com.gmail.nossr50.skills.repair.repairables;
public class RepairableManagerFactory {
public static RepairableManager getRepairManager() {
// TODO: Add in loading from config what type of manager we want.
return new SimpleRepairableManager();
}
public static RepairableManager getRepairManager(int repairablesSize) {
// TODO: Add in loading from config what type of manager we want.
return new SimpleRepairableManager(repairablesSize);
}
}

View File

@ -10,11 +10,11 @@ import org.bukkit.inventory.ItemStack;
public class SimpleRepairableManager implements RepairableManager { public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables; private HashMap<Material, Repairable> repairables;
protected SimpleRepairableManager() { public SimpleRepairableManager() {
this(55); this(55);
} }
protected SimpleRepairableManager(int repairablesSize) { public SimpleRepairableManager(int repairablesSize) {
this.repairables = new HashMap<Material, Repairable>(repairablesSize); this.repairables = new HashMap<Material, Repairable>(repairablesSize);
} }