Refactor all our repairable stuff into a special package.

This commit is contained in:
GJ 2013-10-07 10:23:04 -04:00
parent 4aef4c63fc
commit 3927427b5b
16 changed files with 32 additions and 26 deletions

View File

@ -8,7 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.ArcaneForging;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.util.Permissions;
public class RepairCommand extends SkillCommand {

View File

@ -9,7 +9,7 @@ import org.bukkit.entity.EntityType;
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
import com.gmail.nossr50.util.StringUtils;
public class ExperienceConfig extends AutoUpdateConfigLoader {

View File

@ -10,10 +10,10 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairItemType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomArmorConfig extends ConfigLoader {
private static CustomArmorConfig instance;

View File

@ -12,10 +12,10 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.mods.CustomTool;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairItemType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomToolConfig extends ConfigLoader {
private static CustomToolConfig instance;

View File

@ -35,10 +35,10 @@ import com.gmail.nossr50.runnables.database.UserPurgeTask;
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.child.ChildConfig;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableManager;
import com.gmail.nossr50.skills.repair.RepairableManagerFactory;
import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
import com.gmail.nossr50.skills.repair.repairables.RepairableManagerFactory;
import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.LogFilter;
import com.gmail.nossr50.util.Misc;

View File

@ -21,6 +21,7 @@ import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;

View File

@ -10,10 +10,10 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairItemType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
import com.gmail.nossr50.util.ItemUtils;
public class RepairConfig extends ConfigLoader {

View File

@ -6,7 +6,7 @@ import java.util.List;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
public class RepairConfigManager {
private List<Repairable> repairables;

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import org.bukkit.Material;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,8 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import org.bukkit.Material;
public interface Repairable {
/**
* Gets the type of this repairable item

View File

@ -1,7 +1,8 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import org.bukkit.Material;
public class RepairableFactory {
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import java.util.List;

View File

@ -1,4 +1,5 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
public class RepairableManagerFactory {
public static RepairableManager getRepairManager() {

View File

@ -1,7 +1,8 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import org.bukkit.Material;
public class SimpleRepairable implements Repairable {
private final Material itemMaterial, repairMaterial;
private final int minimumQuantity, minimumLevel;

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.skills.repair;
package com.gmail.nossr50.skills.repair.repairables;
import java.util.HashMap;
import java.util.List;
@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables;