mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Refactor all our repairable stuff into a special package.
This commit is contained in:
parent
4aef4c63fc
commit
3927427b5b
@ -8,7 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
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;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class RepairCommand extends SkillCommand {
|
public class RepairCommand extends SkillCommand {
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
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;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||||
|
@ -10,10 +10,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.repair.RepairItemType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||||
import com.gmail.nossr50.skills.repair.RepairMaterialType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
|
|
||||||
public class CustomArmorConfig extends ConfigLoader {
|
public class CustomArmorConfig extends ConfigLoader {
|
||||||
private static CustomArmorConfig instance;
|
private static CustomArmorConfig instance;
|
||||||
|
@ -12,10 +12,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.repair.RepairItemType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||||
import com.gmail.nossr50.skills.repair.RepairMaterialType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
|
|
||||||
public class CustomToolConfig extends ConfigLoader {
|
public class CustomToolConfig extends ConfigLoader {
|
||||||
private static CustomToolConfig instance;
|
private static CustomToolConfig instance;
|
||||||
|
@ -35,10 +35,10 @@ import com.gmail.nossr50.runnables.database.UserPurgeTask;
|
|||||||
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
|
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.child.ChildConfig;
|
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.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.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;
|
||||||
|
@ -21,6 +21,7 @@ import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
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.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
@ -10,10 +10,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.repair.RepairItemType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||||
import com.gmail.nossr50.skills.repair.RepairMaterialType;
|
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
|
||||||
public class RepairConfig extends ConfigLoader {
|
public class RepairConfig extends ConfigLoader {
|
||||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
|
|
||||||
public class RepairConfigManager {
|
public class RepairConfigManager {
|
||||||
private List<Repairable> repairables;
|
private List<Repairable> repairables;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
@ -1,7 +1,8 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
|
||||||
public interface Repairable {
|
public interface Repairable {
|
||||||
/**
|
/**
|
||||||
* Gets the type of this repairable item
|
* Gets the type of this repairable item
|
@ -1,7 +1,8 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
|
||||||
public class RepairableFactory {
|
public class RepairableFactory {
|
||||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
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);
|
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);
|
@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,4 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
|
|
||||||
public class RepairableManagerFactory {
|
public class RepairableManagerFactory {
|
||||||
public static RepairableManager getRepairManager() {
|
public static RepairableManager getRepairManager() {
|
@ -1,7 +1,8 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleRepairable implements Repairable {
|
public class SimpleRepairable implements Repairable {
|
||||||
private final Material itemMaterial, repairMaterial;
|
private final Material itemMaterial, repairMaterial;
|
||||||
private final int minimumQuantity, minimumLevel;
|
private final int minimumQuantity, minimumLevel;
|
@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user