浏览代码

Custom armor can now be repaired.

GJ 13 年之前
父节点
当前提交
bc642deebd

+ 1 - 0
Changelog.txt

@@ -10,6 +10,7 @@ Key:
 Version 1.3.07
  + Added ability to gain XP with custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
  + Added ability to repair custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
+ + Added ability to repair custom armor. Enable custom armor in the config file, then enter the data in the armor.yml file.
  + Added functionality which makes a new folder in all world files "mcmmo_data" to store player placed block information in
  + Added new configurable Hardcore mode functionality to mcMMO
  + Added new configurable Vampirism PVP stat leech for Hardcore mode

+ 1 - 0
src/main/java/com/gmail/nossr50/config/Config.java

@@ -57,6 +57,7 @@ public class Config extends ConfigLoader {
 
     /* SMP Mods */
     public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
+    public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
     public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
 
     /* Commands */

+ 96 - 0
src/main/java/com/gmail/nossr50/config/mods/LoadCustomArmor.java

@@ -0,0 +1,96 @@
+package com.gmail.nossr50.config.mods;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.bukkit.configuration.ConfigurationSection;
+import org.bukkit.inventory.ItemStack;
+
+import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.datatypes.mods.CustomItem;
+
+public class LoadCustomArmor extends ModConfigLoader{
+    private static LoadCustomArmor instance;
+
+    public static LoadCustomArmor getInstance() {
+        if (instance == null) {
+            instance = new LoadCustomArmor(mcMMO.p);
+        }
+
+        return instance;
+    }
+
+    public List<Integer> customBootIDs = new ArrayList<Integer>();
+    public List<Integer> customChestplateIDs = new ArrayList<Integer>();
+    public List<Integer> customHelmetIDs = new ArrayList<Integer>();
+    public List<Integer> customLeggingIDs = new ArrayList<Integer>();
+
+    public LoadCustomArmor(mcMMO plugin) {
+        super(plugin, "armor.yml");
+        config = plugin.getArmorConfig();
+    }
+
+    @Override
+    public void load() {
+        if (!configFile.exists()) {
+            dataFolder.mkdir();
+            plugin.saveArmorConfig();
+        }
+
+        addDefaults();
+        loadKeys();
+    }
+
+    @Override
+    protected void loadKeys() {
+        plugin.getLogger().info("Loading mcMMO armor.yml File...");
+
+        loadArmor("Boots", customBootIDs);
+        loadArmor("Chestplates", customChestplateIDs);
+        loadArmor("Helmets", customHelmetIDs);
+        loadArmor("Leggings", customLeggingIDs);
+    }
+
+    private void loadArmor(String armorType, List<Integer> idList) {
+        ConfigurationSection armorSection = config.getConfigurationSection(armorType);
+        Set<String> armorConfigSet = armorSection.getKeys(false);
+        Iterator<String> iterator = armorConfigSet.iterator();
+
+        while (iterator.hasNext()) {
+            String armorName = iterator.next();
+
+            int id = config.getInt(armorType + "." + armorName + ".ID", 0);
+            boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
+            int repairID = config.getInt(armorType + "." + armorName + ".Repair_Material_ID", 0);
+            byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", 0);
+            int repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 0);
+            short durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 0);
+
+            if (id == 0) {
+                plugin.getLogger().warning("Missing ID. This item will be skipped.");
+                continue;
+            }
+
+            if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0)) {
+                plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable.");
+                repairable = false;
+            }
+
+            CustomItem armor;
+
+            if (repairable) {
+                ItemStack repairMaterial = new ItemStack(repairID, 1, (short) 0, repairData);
+                armor = new CustomItem(durability, repairMaterial, repairQuantity, repairable, id);
+            }
+            else {
+                armor = new CustomItem(durability, null, 0, repairable, id);
+            }
+
+            idList.add(id);
+            customIDs.add(id);
+            customItems.add(armor);
+        }
+    }
+}

+ 12 - 24
src/main/java/com/gmail/nossr50/config/mods/LoadCustomTools.java

@@ -1,6 +1,5 @@
 package com.gmail.nossr50.config.mods;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -10,10 +9,9 @@ import org.bukkit.configuration.ConfigurationSection;
 import org.bukkit.inventory.ItemStack;
 
 import com.gmail.nossr50.mcMMO;
-import com.gmail.nossr50.config.ConfigLoader;
 import com.gmail.nossr50.datatypes.mods.CustomTool;
 
-public class LoadCustomTools extends ConfigLoader {
+public class LoadCustomTools extends ModConfigLoader {
     private static LoadCustomTools instance;
 
     public static LoadCustomTools getInstance() {
@@ -24,24 +22,15 @@ public class LoadCustomTools extends ConfigLoader {
         return instance;
     }
 
-    public List<CustomTool> customAxes = new ArrayList<CustomTool>();
-    public List<CustomTool> customBows = new ArrayList<CustomTool>();
-    public List<CustomTool> customHoes = new ArrayList<CustomTool>();
-    public List<CustomTool> customPickaxes = new ArrayList<CustomTool>();
-    public List<CustomTool> customShovels = new ArrayList<CustomTool>();
-    public List<CustomTool> customSwords = new ArrayList<CustomTool>();
-    public List<CustomTool> customTools = new ArrayList<CustomTool>();
-
     public List<Integer> customAxeIDs = new ArrayList<Integer>();
     public List<Integer> customBowIDs = new ArrayList<Integer>();
     public List<Integer> customHoeIDs = new ArrayList<Integer>();
     public List<Integer> customPickaxeIDs = new ArrayList<Integer>();
     public List<Integer> customShovelIDs = new ArrayList<Integer>();
     public List<Integer> customSwordIDs = new ArrayList<Integer>();
-    public List<Integer> customIDs = new ArrayList<Integer>();
 
     private LoadCustomTools(mcMMO plugin) {
-        super(plugin, "ModConfigs" + File.separator + "tools.yml");
+        super(plugin, "tools.yml");
         config = plugin.getToolsConfig();
     }
 
@@ -60,15 +49,15 @@ public class LoadCustomTools extends ConfigLoader {
     protected void loadKeys() {
         plugin.getLogger().info("Loading mcMMO tools.yml File...");
 
-        loadTool("Axes", customAxes, customAxeIDs);
-        loadTool("Bows", customBows, customBowIDs);
-        loadTool("Hoes", customHoes, customHoeIDs);
-        loadTool("Pickaxes", customPickaxes, customPickaxeIDs);
-        loadTool("Shovels", customShovels, customShovelIDs);
-        loadTool("Swords", customSwords, customSwordIDs);
+        loadTool("Axes", customAxeIDs);
+        loadTool("Bows", customBowIDs);
+        loadTool("Hoes", customHoeIDs);
+        loadTool("Pickaxes", customPickaxeIDs);
+        loadTool("Shovels", customShovelIDs);
+        loadTool("Swords", customSwordIDs);
     }
 
-    private void loadTool(String toolType, List<CustomTool> toolList, List<Integer> idList) {
+    private void loadTool(String toolType, List<Integer> idList) {
         ConfigurationSection toolSection = config.getConfigurationSection(toolType);
         Set<String> toolConfigSet = toolSection.getKeys(false);
         Iterator<String> iterator = toolConfigSet.iterator();
@@ -76,7 +65,7 @@ public class LoadCustomTools extends ConfigLoader {
         while (iterator.hasNext()) {
             String toolName = iterator.next();
 
-            int id = config.getInt(toolType + "." + toolName + ".ID");
+            int id = config.getInt(toolType + "." + toolName + ".ID", 0);
             double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
             boolean abilityEnabled = config.getBoolean(toolType + "." + toolName + ".Ability_Enabled", true);
             boolean repairable = config.getBoolean(toolType + "." + toolName + ".Repairable");
@@ -90,7 +79,7 @@ public class LoadCustomTools extends ConfigLoader {
                 continue;
             }
 
-            if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0 )) {
+            if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0)) {
                 plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable.");
                 repairable = false;
             }
@@ -105,10 +94,9 @@ public class LoadCustomTools extends ConfigLoader {
                 tool = new CustomTool(durability, null, 0, repairable, abilityEnabled, multiplier, id);
             }
 
-            toolList.add(tool);
             idList.add(id);
             customIDs.add(id);
-            customTools.add(tool);
+            customItems.add(tool);
         }
     }
 }

+ 18 - 0
src/main/java/com/gmail/nossr50/config/mods/ModConfigLoader.java

@@ -0,0 +1,18 @@
+package com.gmail.nossr50.config.mods;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.config.ConfigLoader;
+import com.gmail.nossr50.datatypes.mods.CustomItem;
+
+public abstract class ModConfigLoader extends ConfigLoader{
+    public List<Integer> customIDs = new ArrayList<Integer>();
+    public List<CustomItem> customItems = new ArrayList<CustomItem>();
+
+    public ModConfigLoader(mcMMO plugin, String fileName) {
+        super(plugin, "ModConfigs" + File.separator + fileName);
+    }
+}

+ 60 - 0
src/main/java/com/gmail/nossr50/datatypes/mods/CustomItem.java

@@ -0,0 +1,60 @@
+package com.gmail.nossr50.datatypes.mods;
+
+import org.bukkit.inventory.ItemStack;
+
+public class CustomItem {
+    protected int itemID;
+    protected boolean repairable;
+    protected ItemStack repairMaterial;
+    protected int repairQuantity;
+    protected short durability;
+
+    public CustomItem(short durability, ItemStack repairMaterial, int repairQuantity, boolean repairable, int itemID) {
+        this.itemID = itemID;
+        this.repairable = repairable;
+        this.repairMaterial = repairMaterial;
+        this.repairQuantity = repairQuantity;
+        this.durability = durability;
+    }
+
+    public int getItemID() {
+        return itemID;
+    }
+
+    public void setItemID(int itemID) {
+        this.itemID = itemID;
+    }
+
+
+    public boolean isRepairable() {
+        return repairable;
+    }
+
+    public void setRepairable(boolean repairable) {
+        this.repairable = repairable;
+    }
+
+    public ItemStack getRepairMaterial() {
+        return repairMaterial;
+    }
+
+    public void setRepairMaterial(ItemStack repairMaterial) {
+        this.repairMaterial = repairMaterial;
+    }
+
+    public int getRepairQuantity() {
+        return repairQuantity;
+    }
+
+    public void setRepairQuantity(int repairQuantity) {
+        this.repairQuantity = repairQuantity;
+    }
+
+    public short getDurability() {
+        return durability;
+    }
+
+    public void setDurability(short durability) {
+        this.durability = durability;
+    }
+}

+ 2 - 51
src/main/java/com/gmail/nossr50/datatypes/mods/CustomTool.java

@@ -2,31 +2,14 @@ package com.gmail.nossr50.datatypes.mods;
 
 import org.bukkit.inventory.ItemStack;
 
-public class CustomTool {
-    private int itemID;
+public class CustomTool extends CustomItem {
     private double xpMultiplier;
     private boolean abilityEnabled;
-    private boolean repairable;
-    private ItemStack repairMaterial;
-    private int repairQuantity;
-    private short durability;
 
     public CustomTool(short durability, ItemStack repairMaterial, int repairQuantity, boolean repairable, boolean abilityEnabled, double xpMultiplier, int itemID) {
-        this.itemID = itemID;
+        super(durability, repairMaterial, repairQuantity, repairable, itemID);
         this.xpMultiplier = xpMultiplier;
         this.abilityEnabled = abilityEnabled;
-        this.repairable = repairable;
-        this.repairMaterial = repairMaterial;
-        this.repairQuantity = repairQuantity;
-        this.durability = durability;
-    }
-
-    public int getItemID() {
-        return itemID;
-    }
-
-    public void setItemID(int itemID) {
-        this.itemID = itemID;
     }
 
     public double getXpMultiplier() {
@@ -44,36 +27,4 @@ public class CustomTool {
     public void setAbilityEnabled(boolean abilityEnabled) {
         this.abilityEnabled = abilityEnabled;
     }
-
-    public boolean isRepairable() {
-        return repairable;
-    }
-
-    public void setRepairable(boolean repairable) {
-        this.repairable = repairable;
-    }
-
-    public ItemStack getRepairMaterial() {
-        return repairMaterial;
-    }
-
-    public void setRepairMaterial(ItemStack repairMaterial) {
-        this.repairMaterial = repairMaterial;
-    }
-
-    public int getRepairQuantity() {
-        return repairQuantity;
-    }
-
-    public void setRepairQuantity(int repairQuantity) {
-        this.repairQuantity = repairQuantity;
-    }
-
-    public short getDurability() {
-        return durability;
-    }
-
-    public void setDurability(short durability) {
-        this.durability = durability;
-    }
 }

+ 58 - 0
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -8,6 +8,7 @@ import com.gmail.nossr50.commands.party.*;
 import com.gmail.nossr50.commands.general.*;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.LoadTreasures;
+import com.gmail.nossr50.config.mods.LoadCustomArmor;
 import com.gmail.nossr50.config.mods.LoadCustomTools;
 import com.gmail.nossr50.runnables.*;
 import com.gmail.nossr50.util.Database;
@@ -77,6 +78,10 @@ public class mcMMO extends JavaPlugin {
             LoadCustomTools.getInstance().load();
         }
 
+        if (configInstance.getArmorModsEnabled()) {
+            LoadCustomArmor.getInstance().load();
+        }
+
         if (!configInstance.getUseMySQL()) {
             Users.loadUsers();
         }
@@ -440,4 +445,57 @@ public class mcMMO extends JavaPlugin {
             getLogger().severe("Could not save config to " + toolsConfigFile + ex.toString());
         }
     }
+
+    /*
+     * Boilerplate Custom Config Stuff (Armor)
+     */
+
+    private FileConfiguration armorConfig = null;
+    private File armorConfigFile = null;
+
+    /**
+     * Reload the Armor.yml file.
+     */
+    public void reloadArmorConfig() {
+        if (armorConfigFile == null) {
+            armorConfigFile = new File(modDirectory, "armor.yml");
+        }
+
+        armorConfig = YamlConfiguration.loadConfiguration(armorConfigFile);
+        InputStream defConfigStream = getResource("armor.yml"); // Look for defaults in the jar
+
+        if (defConfigStream != null) {
+            YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+            armorConfig.setDefaults(defConfig);
+        }
+    }
+
+    /**
+     * Get the Armor config information.
+     *
+     * @return the configuration object for armor.yml
+     */
+    public FileConfiguration getArmorConfig() {
+        if (armorConfig == null) {
+            reloadArmorConfig();
+        }
+
+        return armorConfig;
+    }
+
+    /**
+     * Save the Armor config informtion.
+     */
+    public void saveArmorConfig() {
+        if (armorConfig == null || armorConfigFile == null) {
+            return;
+        }
+
+        try {
+            armorConfig.save(armorConfigFile);
+        }
+        catch (IOException ex) {
+            getLogger().severe("Could not save config to " + armorConfigFile + ex.toString());
+        }
+    }
 }

+ 50 - 9
src/main/java/com/gmail/nossr50/skills/misc/Repair.java

@@ -16,16 +16,18 @@ import org.getspout.spoutapi.player.SpoutPlayer;
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.Config;
+import com.gmail.nossr50.config.mods.LoadCustomArmor;
 import com.gmail.nossr50.config.mods.LoadCustomTools;
 import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.ItemChecks;
 import com.gmail.nossr50.util.Misc;
+import com.gmail.nossr50.util.ModChecks;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.Skills;
 import com.gmail.nossr50.util.Users;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.SkillType;
-import com.gmail.nossr50.datatypes.mods.CustomTool;
+import com.gmail.nossr50.datatypes.mods.CustomItem;
 import com.gmail.nossr50.events.skills.McMMOPlayerRepairCheckEvent;
 import com.gmail.nossr50.locale.LocaleLoader;
 
@@ -113,10 +115,35 @@ public class Repair {
             else if (ItemChecks.isCustomTool(is) && permInstance.toolRepair(player)) {
                 LoadCustomTools toolsInstance = LoadCustomTools.getInstance();
 
-                for (CustomTool tool : toolsInstance.customTools) {
+                for (CustomItem tool : toolsInstance.customItems) {
                     if (tool.getItemID() == is.getTypeId()) {
-                        if (inventory.contains(tool.getRepairMaterial())) {
-                            repairCustomItem(player, is, tool.getRepairMaterial());
+                        ItemStack repairMaterial = tool.getRepairMaterial();
+
+                        if (inventory.contains(repairMaterial)) {
+                            repairCustomItem(player, is, repairMaterial);
+                            xpHandler(player, PP, is, durabilityBefore, 1, true);
+                        }
+                        else {
+                            needMoreVespeneGas(is, player);
+                        }
+
+                        break;
+                    }
+                }
+            }
+
+            /*
+             * REPAIR CUSTOM ARMOR
+             */
+            else if (ItemChecks.isCustomArmor(is) && permInstance.armorRepair(player)) {
+                LoadCustomArmor armorInstance = LoadCustomArmor.getInstance();
+
+                for (CustomItem armor : armorInstance.customItems) {
+                    if (armor.getItemID() == is.getTypeId()) {
+                        ItemStack repairMaterial = armor.getRepairMaterial();
+
+                        if (inventory.contains(repairMaterial)) {
+                            repairCustomItem(player, is, repairMaterial);
                             xpHandler(player, PP, is, durabilityBefore, 1, true);
                         }
                         else {
@@ -384,11 +411,25 @@ public class Repair {
         int materialsRequired = 0;
         int repairAmount = 0;
 
-        for (CustomTool tool : LoadCustomTools.getInstance().customTools) {
-            if (tool.getItemID() == is.getTypeId()) {
-                maxDurability = tool.getDurability();
-                materialsRequired = tool.getRepairQuantity();
-                break;
+        LoadCustomTools toolInstance = LoadCustomTools.getInstance();
+        LoadCustomArmor armorInstance = LoadCustomArmor.getInstance();
+
+        if (ModChecks.getToolFromItemStack(is) != null) {
+            for (CustomItem tool : toolInstance.customItems) {
+                if (tool.getItemID() == is.getTypeId()) {
+                    maxDurability = tool.getDurability();
+                    materialsRequired = tool.getRepairQuantity();
+                    break;
+                }
+            }
+        }
+        else if (ModChecks.getArmorFromItemStack(is) != null) {
+            for (CustomItem armor : armorInstance.customItems) {
+                if (armor.getItemID() == is.getTypeId()) {
+                    maxDurability = armor.getDurability();
+                    materialsRequired = armor.getRepairQuantity();
+                    break;
+                }
             }
         }
 

+ 41 - 4
src/main/java/com/gmail/nossr50/util/ItemChecks.java

@@ -3,11 +3,13 @@ package com.gmail.nossr50.util;
 import org.bukkit.inventory.ItemStack;
 
 import com.gmail.nossr50.config.Config;
+import com.gmail.nossr50.config.mods.LoadCustomArmor;
 import com.gmail.nossr50.config.mods.LoadCustomTools;
 
 public class ItemChecks {
     private static Config configInstance = Config.getInstance();
     private static boolean customToolsEnabled = configInstance.getToolModsEnabled();
+    private static boolean customArmorEnabled = configInstance.getArmorModsEnabled();
 
     /**
      * Checks if the item is a sword.
@@ -149,7 +151,12 @@ public class ItemChecks {
             return true;
 
         default:
-            return false;
+            if (customArmorEnabled && LoadCustomArmor.getInstance().customHelmetIDs.contains(is.getTypeId())) {
+                return true;
+            }
+            else {
+                return false;
+            }
         }
     }
 
@@ -168,7 +175,12 @@ public class ItemChecks {
             return true;
 
         default:
-            return false;
+            if (customArmorEnabled && LoadCustomArmor.getInstance().customChestplateIDs.contains(is.getTypeId())) {
+                return true;
+            }
+            else {
+                return false;
+            }
         }
     }
 
@@ -187,7 +199,12 @@ public class ItemChecks {
             return true;
 
         default:
-            return false;
+            if (customArmorEnabled && LoadCustomArmor.getInstance().customLeggingIDs.contains(is.getTypeId())) {
+                return true;
+            }
+            else {
+                return false;
+            }
         }
     }
 
@@ -206,7 +223,12 @@ public class ItemChecks {
             return true;
 
         default:
-            return false;
+            if (customArmorEnabled && LoadCustomArmor.getInstance().customBootIDs.contains(is.getTypeId())) {
+                return true;
+            }
+            else {
+                return false;
+            }
         }
     }
 
@@ -220,6 +242,21 @@ public class ItemChecks {
         return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
     }
 
+    /**
+     * Checks to see if an item is a custom tool.
+     *
+     * @param is Item to check
+     * @return true if the item is a custom tool, false otherwise
+     */
+    public static boolean isCustomArmor(ItemStack is) {
+        if (customArmorEnabled && LoadCustomArmor.getInstance().customIDs.contains(is.getTypeId())) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
     /**
      * Checks to see if an item is a leather armor piece.
      *

+ 45 - 7
src/main/java/com/gmail/nossr50/util/ModChecks.java

@@ -2,10 +2,14 @@ package com.gmail.nossr50.util;
 
 import org.bukkit.inventory.ItemStack;
 
+import com.gmail.nossr50.config.mods.LoadCustomArmor;
 import com.gmail.nossr50.config.mods.LoadCustomTools;
+import com.gmail.nossr50.datatypes.mods.CustomItem;
 import com.gmail.nossr50.datatypes.mods.CustomTool;
 
 public class ModChecks {
+    private static LoadCustomTools toolInstance = LoadCustomTools.getInstance();
+    private static LoadCustomArmor armorInstance = LoadCustomArmor.getInstance();
 
     /**
      * Check if this custom tool can use abilities.
@@ -14,25 +18,59 @@ public class ModChecks {
      * @return true if the tool can use abilities, false otherwise
      */
     public static boolean toolAbilityEnabled(ItemStack item) {
-        for (CustomTool tool : LoadCustomTools.getInstance().customTools) {
-            if (tool.getItemID() == item.getTypeId()) {
-                return tool.isAbilityEnabled();
+        int id = item.getTypeId();
+
+        if (!toolInstance.customIDs.contains(id)) {
+            return false;
+        }
+
+        for (CustomItem tool : toolInstance.customItems) {
+            if (tool.getItemID() == id) {
+                return ((CustomTool) tool).isAbilityEnabled();
             }
         }
 
         return false;
     }
 
+    /**
+     * Get the custom armor associated with an item.
+     *
+     * @param item The item to check
+     * @return the ay if it exists, null otherwise
+     */
+    public static CustomItem getArmorFromItemStack(ItemStack item) {
+        int id = item.getTypeId();
+
+        if (!armorInstance.customIDs.contains(id)) {
+            return null;
+        }
+
+        for (CustomItem armor : armorInstance.customItems) {
+            if (armor.getItemID() == id) {
+                return armor;
+            }
+        }
+
+        return null;
+    }
+
     /**
      * Get the custom tool associated with an item.
      *
      * @param item The item to check
-     * @return the tool if it exists, null otherwise
+     * @return the armor if it exists, null otherwise
      */
     public static CustomTool getToolFromItemStack(ItemStack item) {
-        for (CustomTool tool : LoadCustomTools.getInstance().customTools) {
-            if (tool.getItemID() == item.getTypeId()) {
-                return tool;
+        int id = item.getTypeId();
+
+        if (!toolInstance.customIDs.contains(id)) {
+            return null;
+        }
+
+        for (CustomItem tool : toolInstance.customItems) {
+            if (tool.getItemID() == id) {
+                return (CustomTool) tool;
             }
         }
 

+ 75 - 0
src/main/resources/armor.yml

@@ -0,0 +1,75 @@
+#
+#  Settings for Boots
+###
+Boots:
+    Boot_1:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+    Boot_2:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+
+#
+#  Settings for Chestplates
+###
+Chestplates:
+    Chestplate_1:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+    Chestplate_2:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+
+#
+#  Settings for Helmets
+###
+Helmets:
+    Helmet_1:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+    Helmet_2:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+
+#
+#  Settings for Leggings
+###
+Leggings:
+    Legging_1:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999
+    Legging_2:
+        ID: 999
+        Repairable: true
+        Repair_Material_ID: 99
+        Repair_Material_Data_Value: 0
+        Repair_Material_Quantity: 9
+        Durability: 9999

+ 1 - 0
src/main/resources/config.yml

@@ -45,6 +45,7 @@ Hardcore:
 ###
 Mods:
     Tool_Mods_Enabled: false
+    Armor_Mods_Enabled: false
     Block_Mods_Enabled: false
 
 #