Răsfoiți Sursa

treasures.yml is now split into 3 treasure configs

nossr50 6 ani în urmă
părinte
comite
41bfba0c68

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

@@ -3,7 +3,7 @@ package com.gmail.nossr50.config;
 /**
 /**
  * A class that is expected to register one thing into another thing
  * A class that is expected to register one thing into another thing
  */
  */
-public interface Registers {
+public interface Registers extends Unload {
     /**
     /**
      * Register stuff
      * Register stuff
      */
      */

+ 4 - 0
src/main/java/com/gmail/nossr50/config/treasure/ExcavationTreasureConfig.java

@@ -0,0 +1,4 @@
+package com.gmail.nossr50.config.treasure;
+
+public class ExcavationTreasureConfig {
+}

+ 4 - 0
src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java

@@ -0,0 +1,4 @@
+package com.gmail.nossr50.config.treasure;
+
+public class FishingTreasureConfig {
+}

+ 4 - 0
src/main/java/com/gmail/nossr50/config/treasure/HerbalismTreasureConfig.java

@@ -0,0 +1,4 @@
+package com.gmail.nossr50.config.treasure;
+
+public class HerbalismTreasureConfig {
+}

+ 191 - 59
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java

@@ -1,12 +1,15 @@
 package com.gmail.nossr50.config.treasure;
 package com.gmail.nossr50.config.treasure;
 
 
+import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.ConfigCollection;
 import com.gmail.nossr50.config.ConfigCollection;
+import com.gmail.nossr50.config.Registers;
 import com.gmail.nossr50.config.UnsafeValueValidation;
 import com.gmail.nossr50.config.UnsafeValueValidation;
 import com.gmail.nossr50.datatypes.treasure.*;
 import com.gmail.nossr50.datatypes.treasure.*;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.EnchantmentUtils;
 import com.gmail.nossr50.util.EnchantmentUtils;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.StringUtils;
 import com.google.common.reflect.TypeToken;
 import com.google.common.reflect.TypeToken;
+import ninja.leaping.configurate.ConfigurationNode;
 import ninja.leaping.configurate.objectmapping.ObjectMappingException;
 import ninja.leaping.configurate.objectmapping.ObjectMappingException;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.Tag;
 import org.bukkit.Tag;
@@ -23,7 +26,15 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 
 
-public class TreasureConfig extends ConfigCollection implements UnsafeValueValidation {
+//TODO: Need to rewrite this too
+public class TreasureConfig extends Config implements UnsafeValueValidation, Registers {
+
+    public static final String ENCHANTMENT_DROP_RATES = "Enchantment_Drop_Rates";
+    public static final String ITEM_DROP_RATES = "Item_Drop_Rates";
+    public static final String FISHING = "Fishing";
+    public static final String EXCAVATION = "Excavation";
+    public static final String SHAKE = "Shake";
+    public static final String HYLIAN_LUCK = "Hylian_Luck";
 
 
     public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
     public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
 
 
@@ -36,6 +47,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
     public TreasureConfig() {
     public TreasureConfig() {
         //super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"treasures.yml");
         //super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"treasures.yml");
         super(mcMMO.p.getDataFolder().getAbsoluteFile(), "treasures.yml", false, true, false);
         super(mcMMO.p.getDataFolder().getAbsoluteFile(), "treasures.yml", false, true, false);
+        register();
         validateEntries();
         validateEntries();
     }
     }
 
 
@@ -61,38 +73,59 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
         return 1;
         return 1;
     }
     }
 
 
+    @Override
+    public void unload() {
+        excavationMap.clear();
+
+        shakeMap.clear();
+
+        hylianMap.clear();
+
+        fishingRewards.clear();
+
+        fishingEnchantments.clear();
+    }
+
     @Override
     @Override
     public List<String> validateKeys() {
     public List<String> validateKeys() {
         // Validate all the settings!
         // Validate all the settings!
         List<String> errorMessages = new ArrayList<String>();
         List<String> errorMessages = new ArrayList<String>();
         try {
         try {
-            for (String tier : getUserRootNode().getNode("Enchantment_Drop_Rates").getList(TypeToken.of(String.class))) {
-                double totalEnchantDropRate = 0;
-                double totalItemDropRate = 0;
+            for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
+                /*double totalEnchantDropRate = 0;
+                double totalItemDropRate = 0;*/
 
 
                 for (Rarity rarity : Rarity.values()) {
                 for (Rarity rarity : Rarity.values()) {
-                    double enchantDropRate = getDoubleValue("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
-                    double itemDropRate = getDoubleValue("Item_Drop_Rates." + tier + "." + rarity.toString());
+                    double enchantDropRate = getDoubleValue(ENCHANTMENT_DROP_RATES, tier, rarity.toString());
+                    double itemDropRate = getDoubleValue(ITEM_DROP_RATES, tier, rarity.toString());
 
 
                     if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
                     if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
                         errorMessages.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
                         errorMessages.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
+
+                        //Bound Values
+                        /*enchantDropRate = boundValues(enchantDropRate, 0.0D, 100.0D);*/
                     }
                     }
 
 
                     if (itemDropRate < 0.0 || itemDropRate > 100.0) {
                     if (itemDropRate < 0.0 || itemDropRate > 100.0) {
                         errorMessages.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
                         errorMessages.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
+
+                        //Bound Values
+                        /*itemDropRate = boundValues(itemDropRate, 0.0D, 100.0D);*/
                     }
                     }
 
 
-                    totalEnchantDropRate += enchantDropRate;
-                    totalItemDropRate += itemDropRate;
+                    /*totalEnchantDropRate += enchantDropRate;
+                    totalItemDropRate += itemDropRate;*/
                 }
                 }
 
 
-                if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
+                //TODO: Why does it matter what the total item/enchant drop rate is?
+
+                /*if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
                     errorMessages.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
                     errorMessages.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
                 }
                 }
 
 
                 if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
                 if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
                     errorMessages.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
                     errorMessages.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
-                }
+                }*/
             }
             }
         } catch (ObjectMappingException e) {
         } catch (ObjectMappingException e) {
             e.printStackTrace();
             e.printStackTrace();
@@ -101,34 +134,62 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
         return errorMessages;
         return errorMessages;
     }
     }
 
 
-    @Override
-    protected void register() {
-        if (config.getConfigurationSection("Treasures") != null) {
-            backup();
-            return;
-        }
+    private double boundValues(double valueRef, double min, double max)
+    {
+        if(valueRef < min)
+            valueRef = min;
+        else if(valueRef > max)
+            valueRef = max;
 
 
-        loadTreasures("Fishing");
+        return valueRef;
+    }
+
+    @Override
+    public void register() {
+        /*loadTreasures("Fishing");
         loadTreasures("Excavation");
         loadTreasures("Excavation");
-        loadTreasures("Hylian_Luck");
+        loadTreasures("Hylian_Luck");*/
+
+        initRegisters();
+
+        loadFishing();
+        loadExcavation();
+        loadHerbalism();
+
         loadEnchantments();
         loadEnchantments();
 
 
         for (EntityType entity : EntityType.values()) {
         for (EntityType entity : EntityType.values()) {
             if (entity.isAlive()) {
             if (entity.isAlive()) {
-                loadTreasures("Shake." + entity.toString());
+                loadShake(entity);
             }
             }
         }
         }
     }
     }
 
 
-    private void loadTreasures(String type) {
-        boolean isFishing = type.equals("Fishing");
-        boolean isShake = type.contains("Shake");
-        boolean isExcavation = type.equals("Excavation");
-        boolean isHylian = type.equals("Hylian_Luck");
+    private void initRegisters()
+    {
+        if(excavationMap == null)
+            excavationMap = new HashMap<>();
+
+        if(shakeMap == null)
+            shakeMap = new HashMap<>();
+
+        if(hylianMap == null)
+            hylianMap = new HashMap<>();
+
+        if(fishingRewards == null)
+            fishingRewards = new HashMap<>();
 
 
-        ConfigurationSection treasureSection = config.getConfigurationSection(type);
+        if(fishingEnchantments == null)
+            fishingEnchantments = new HashMap<>();
+    }
+
+    private void loadFishing()
+    {
+        ConfigurationNode fishingTreasureNode = getUserRootNode().getNode(FISHING);
 
 
-        if (treasureSection == null) {
+        if(fishingTreasureNode == null)
+        {
+            mcMMO.p.getLogger().info("Fishing treasures in treasures config not defined");
             return;
             return;
         }
         }
 
 
@@ -139,9 +200,80 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
             }
             }
         }
         }
 
 
-        for (String treasureName : treasureSection.getKeys(false)) {
+        try {
+            for (String treasureName : fishingTreasureNode.getList(TypeToken.of(String.class))) {
+
+            }
+        } catch (ObjectMappingException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void loadExcavation()
+    {
+        ConfigurationNode excavationTreasureNode = getUserRootNode().getNode(EXCAVATION);
+
+        if(excavationTreasureNode == null)
+        {
+            mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
+            return;
+        }
+
+        try {
+            for (String treasureName : excavationTreasureNode.getList(TypeToken.of(String.class))) {
+
+            }
+        } catch (ObjectMappingException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void loadHerbalism()
+    {
+        ConfigurationNode herbalismTreasureNode = getUserRootNode().getNode(HYLIAN_LUCK);
+
+        if(herbalismTreasureNode == null)
+        {
+            mcMMO.p.getLogger().info("Hylian_Luck in treasures config not defined");
+            return;
+        }
+
+        try {
+            for (String treasureName : herbalismTreasureNode.getList(TypeToken.of(String.class))) {
+
+            }
+        } catch (ObjectMappingException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void loadShake(EntityType entityType)
+    {
+        ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
+
+        if(shakeTreasureNode != null)
+            return;
+
+        try {
+            for (String treasureName : shakeTreasureNode.getList(TypeToken.of(String.class))) {
+
+            }
+        } catch (ObjectMappingException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void loadTreasures(ConfigurationNode treasureChildNode) {
+        if (treasureChildNode == null) {
+            return;
+        }
+
+
+
+        for (String treasureName : treasureChildNode.getKeys(false)) {
             // Validate all the things!
             // Validate all the things!
-            List<String> reason = new ArrayList<String>();
+            List<String> errorMessages = new ArrayList<String>();
 
 
             String[] treasureInfo = treasureName.split("[|]");
             String[] treasureInfo = treasureName.split("[|]");
             String materialName = treasureInfo[0];
             String materialName = treasureInfo[0];
@@ -161,39 +293,39 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
                 material = Material.matchMaterial(materialName);
                 material = Material.matchMaterial(materialName);
             }
             }
 
 
-            int amount = getIntValue(type + "." + treasureName + ".Amount");
-            short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) getIntValue(type + "." + treasureName + ".Data");
+            int amount = getIntValue(treasureChildNodeAddress + "." + treasureName + ".Amount");
+            short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) getIntValue(treasureChildNodeAddress + "." + treasureName + ".Data");
 
 
             if (material == null) {
             if (material == null) {
-                reason.add("Invalid material: " + materialName);
+                errorMessages.add("Invalid material: " + materialName);
             }
             }
 
 
             if (amount <= 0) {
             if (amount <= 0) {
-                reason.add("Amount of " + treasureName + " must be greater than 0! " + amount);
+                errorMessages.add("Amount of " + treasureName + " must be greater than 0! " + amount);
             }
             }
 
 
             if (material != null && material.isBlock() && (data > 127 || data < -128)) {
             if (material != null && material.isBlock() && (data > 127 || data < -128)) {
-                reason.add("Data of " + treasureName + " is invalid! " + data);
+                errorMessages.add("Data of " + treasureName + " is invalid! " + data);
             }
             }
 
 
             /*
             /*
              * XP, Drop Chance, and Drop Level
              * XP, Drop Chance, and Drop Level
              */
              */
 
 
-            int xp = getIntValue(type + "." + treasureName + ".XP");
-            double dropChance = getDoubleValue(type + "." + treasureName + ".Drop_Chance");
-            int dropLevel = getIntValue(type + "." + treasureName + ".Drop_Level");
+            int xp = getIntValue(treasureChildNodeAddress + "." + treasureName + ".XP");
+            double dropChance = getDoubleValue(treasureChildNodeAddress + "." + treasureName + ".Drop_Chance");
+            int dropLevel = getIntValue(treasureChildNodeAddress + "." + treasureName + ".Drop_Level");
 
 
             if (xp < 0) {
             if (xp < 0) {
-                reason.add(treasureName + " has an invalid XP value: " + xp);
+                errorMessages.add(treasureName + " has an invalid XP value: " + xp);
             }
             }
 
 
             if (dropChance < 0.0D) {
             if (dropChance < 0.0D) {
-                reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
+                errorMessages.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
             }
             }
 
 
             if (dropLevel < 0) {
             if (dropLevel < 0) {
-                reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
+                errorMessages.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
             }
             }
 
 
             /*
             /*
@@ -202,10 +334,10 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
             Rarity rarity = null;
             Rarity rarity = null;
 
 
             if (isFishing) {
             if (isFishing) {
-                rarity = Rarity.getRarity(getStringValue(type + "." + treasureName + ".Rarity"));
+                rarity = Rarity.getRarity(getStringValue(treasureChildNodeAddress + "." + treasureName + ".Rarity"));
 
 
                 if (rarity == null) {
                 if (rarity == null) {
-                    reason.add("Invalid Rarity for item: " + treasureName);
+                    errorMessages.add("Invalid Rarity for item: " + treasureName);
                 }
                 }
             }
             }
 
 
@@ -217,28 +349,28 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
             if (materialName.contains("POTION")) {
             if (materialName.contains("POTION")) {
                 Material mat = Material.matchMaterial(materialName);
                 Material mat = Material.matchMaterial(materialName);
                 if (mat == null) {
                 if (mat == null) {
-                    reason.add("Potion format for Treasures.yml has changed");
+                    errorMessages.add("Potion format for Treasures.yml has changed");
                 } else {
                 } else {
                     item = new ItemStack(mat, amount, data);
                     item = new ItemStack(mat, amount, data);
                     PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
                     PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
 
 
                     PotionType potionType = null;
                     PotionType potionType = null;
                     try {
                     try {
-                        potionType = PotionType.valueOf(getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
+                        potionType = PotionType.valueOf(getStringValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.PotionType", "WATER"));
                     } catch (IllegalArgumentException ex) {
                     } catch (IllegalArgumentException ex) {
-                        reason.add("Invalid Potion_Type: " + getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
+                        errorMessages.add("Invalid Potion_Type: " + getStringValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.PotionType", "WATER"));
                     }
                     }
-                    boolean extended = getBooleanValue(type + "." + treasureName + ".PotionData.Extended", false);
-                    boolean upgraded = getBooleanValue(type + "." + treasureName + ".PotionData.Upgraded", false);
+                    boolean extended = getBooleanValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.Extended", false);
+                    boolean upgraded = getBooleanValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.Upgraded", false);
                     itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
                     itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
 
 
-                    if (config.contains(type + "." + treasureName + ".Custom_Name")) {
-                        itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
+                    if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")) {
+                        itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")));
                     }
                     }
 
 
-                    if (config.contains(type + "." + treasureName + ".Lore")) {
+                    if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
                         List<String> lore = new ArrayList<String>();
                         List<String> lore = new ArrayList<String>();
-                        for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
+                        for (String s : getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
                             lore.add(ChatColor.translateAlternateColorCodes('&', s));
                             lore.add(ChatColor.translateAlternateColorCodes('&', s));
                         }
                         }
                         itemMeta.setLore(lore);
                         itemMeta.setLore(lore);
@@ -248,16 +380,16 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
             } else if (material != null) {
             } else if (material != null) {
                 item = new ItemStack(material, amount, data);
                 item = new ItemStack(material, amount, data);
 
 
-                if (config.contains(type + "." + treasureName + ".Custom_Name")) {
+                if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")) {
                     ItemMeta itemMeta = item.getItemMeta();
                     ItemMeta itemMeta = item.getItemMeta();
-                    itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
+                    itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")));
                     item.setItemMeta(itemMeta);
                     item.setItemMeta(itemMeta);
                 }
                 }
 
 
-                if (config.contains(type + "." + treasureName + ".Lore")) {
+                if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
                     ItemMeta itemMeta = item.getItemMeta();
                     ItemMeta itemMeta = item.getItemMeta();
                     List<String> lore = new ArrayList<String>();
                     List<String> lore = new ArrayList<String>();
-                    for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
+                    for (String s : getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
                         lore.add(ChatColor.translateAlternateColorCodes('&', s));
                         lore.add(ChatColor.translateAlternateColorCodes('&', s));
                     }
                     }
                     itemMeta.setLore(lore);
                     itemMeta.setLore(lore);
@@ -265,19 +397,19 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
                 }
                 }
             }
             }
 
 
-            if (noErrorsInConfig(reason)) {
+            if (noErrorsInConfig(errorMessages)) {
                 if (isFishing) {
                 if (isFishing) {
                     fishingRewards.get(rarity).add(new FishingTreasure(item, xp));
                     fishingRewards.get(rarity).add(new FishingTreasure(item, xp));
                 } else if (isShake) {
                 } else if (isShake) {
                     ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
                     ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
 
 
-                    EntityType entityType = EntityType.valueOf(type.substring(6));
+                    EntityType entityType = EntityType.valueOf(treasureChildNodeAddress.substring(6));
                     if (!shakeMap.containsKey(entityType))
                     if (!shakeMap.containsKey(entityType))
                         shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
                         shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
                     shakeMap.get(entityType).add(shakeTreasure);
                     shakeMap.get(entityType).add(shakeTreasure);
                 } else if (isExcavation) {
                 } else if (isExcavation) {
                     ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
                     ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
-                    List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
+                    List<String> dropList = getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Drops_From");
 
 
                     for (String blockType : dropList) {
                     for (String blockType : dropList) {
                         if (!excavationMap.containsKey(blockType))
                         if (!excavationMap.containsKey(blockType))
@@ -286,7 +418,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
                     }
                     }
                 } else if (isHylian) {
                 } else if (isHylian) {
                     HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
                     HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
-                    List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
+                    List<String> dropList = getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Drops_From");
 
 
                     for (String dropper : dropList) {
                     for (String dropper : dropList) {
                         if (dropper.equals("Bushes")) {
                         if (dropper.equals("Bushes")) {
@@ -375,7 +507,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
     }
     }
 
 
     public double getItemDropRate(int tier, Rarity rarity) {
     public double getItemDropRate(int tier, Rarity rarity) {
-        return getDoubleValue("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
+        return getDoubleValue(ITEM_DROP_RATES + ".Tier_" + tier + "." + rarity.toString());
     }
     }
 
 
     public double getEnchantmentDropRate(int tier, Rarity rarity) {
     public double getEnchantmentDropRate(int tier, Rarity rarity) {

+ 8 - 0
src/main/java/com/gmail/nossr50/config/treasure/TreasureType.java

@@ -0,0 +1,8 @@
+package com.gmail.nossr50.config.treasure;
+
+public enum TreasureType {
+    FISHING,
+    EXCAVATION,
+    HYLIAN,
+    SHAKE
+}

+ 1 - 1
src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java

@@ -22,7 +22,7 @@ public class ZipLibrary {
     private static File MOD_FILE_DIRECTORY = new File(mcMMO.getModDirectory());
     private static File MOD_FILE_DIRECTORY = new File(mcMMO.getModDirectory());
     private static File CONFIG_FILE = new File(mcMMO.getMainDirectory() + "config.yml");
     private static File CONFIG_FILE = new File(mcMMO.getMainDirectory() + "config.yml");
     private static File EXPERIENCE_FILE = new File(mcMMO.getMainDirectory() + "experience.yml");
     private static File EXPERIENCE_FILE = new File(mcMMO.getMainDirectory() + "experience.yml");
-    private static File TREASURE_FILE = new File(mcMMO.getMainDirectory() + "treasures.yml");
+    //private static File TREASURE_FILE = new File(mcMMO.getMainDirectory() + "treasures.yml");
     private static File ADVANCED_FILE = new File(mcMMO.getMainDirectory() + "advanced.yml");
     private static File ADVANCED_FILE = new File(mcMMO.getMainDirectory() + "advanced.yml");
     private static File REPAIR_FILE = new File(mcMMO.getMainDirectory() + "repair.vanilla.yml");
     private static File REPAIR_FILE = new File(mcMMO.getMainDirectory() + "repair.vanilla.yml");
 
 

+ 130 - 0
src/main/resources/excavation_treasures.yml

@@ -0,0 +1,130 @@
+#
+#  Settings for Excavation's Archaeology
+###
+Excavation:
+    CAKE:
+        Amount: 1
+        XP: 3000
+        Drop_Chance: 0.05
+        Drop_Level: 75
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
+    GUNPOWDER:
+        Amount: 1
+        XP: 30
+        Drop_Chance: 10.0
+        Drop_Level: 10
+        Drops_From: [Gravel]
+    BONE:
+        Amount: 1
+        XP: 30
+        Drop_Chance: 10.0
+        Drop_Level: 20
+        Drops_From: [Gravel]
+    APPLE:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 0.1
+        Drop_Level: 25
+        Drops_From: [Grass_Block, Mycelium]
+    SLIME_BALL:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 5.0
+        Drop_Level: 15
+        Drops_From: [Clay]
+    BUCKET:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 0.1
+        Drop_Level: 50
+        Drops_From: [Clay]
+    NETHERRACK:
+        Amount: 1
+        XP: 30
+        Drop_Chance: 0.5
+        Drop_Level: 85
+        Drops_From: [Gravel]
+    RED_MUSHROOM:
+        Amount: 1
+        XP: 80
+        Drop_Chance: 0.5
+        Drop_Level: 50
+        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
+    BROWN_MUSHROOM:
+        Amount: 1
+        XP: 80
+        Drop_Chance: 0.5
+        Drop_Level: 50
+        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
+    EGG:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 1.0
+        Drop_Level: 25
+        Drops_From: [Grass_Block]
+    SOUL_SAND:
+        Amount: 1
+        XP: 80
+        Drop_Chance: 0.5
+        Drop_Level: 65
+        Drops_From: [Sand, Red_Sand]
+    CLOCK:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 0.1
+        Drop_Level: 50
+        Drops_From: [Clay]
+    COBWEB:
+        Amount: 1
+        XP: 150
+        Drop_Chance: 5.0
+        Drop_Level: 75
+        Drops_From: [Clay]
+    STRING:
+        Amount: 1
+        XP: 200
+        Drop_Chance: 5.0
+        Drop_Level: 25
+        Drops_From: [Clay]
+    GLOWSTONE_DUST:
+        Amount: 1
+        XP: 80
+        Drop_Chance: 5.0
+        Drop_Level: 5
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Mycelium]
+    MUSIC_DISC_13:
+        Amount: 1
+        XP: 3000
+        Drop_Chance: 0.05
+        Drop_Level: 25
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
+    MUSIC_DISC_CAT:
+        Amount: 1
+        XP: 3000
+        Drop_Chance: 0.05
+        Drop_Level: 25
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
+    DIAMOND:
+        Amount: 1
+        XP: 1000
+        Drop_Chance: 0.13
+        Drop_Level: 35
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
+    COCOA_BEANS:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 1.33
+        Drop_Level: 35
+        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
+    QUARTZ:
+        Amount: 1
+        XP: 100
+        Drop_Chance: 0.5
+        Drop_Level: 85
+        Drops_From: [Dirt, Podzol, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand]
+    NAME_TAG:
+        Amount: 1
+        XP: 3000
+        Drop_Chance: 0.05
+        Drop_Level: 25
+        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]

+ 0 - 189
src/main/resources/treasures.yml → src/main/resources/fishing_treasures.yml

@@ -390,7 +390,6 @@ Enchantments_Rarity:
         POWER: 5
         POWER: 5
         PUNCH: 2
         PUNCH: 2
         INFINITY: 1
         INFINITY: 1
-
 Enchantment_Drop_Rates:
 Enchantment_Drop_Rates:
     Tier_1:
     Tier_1:
         COMMON: 5.00
         COMMON: 5.00
@@ -441,194 +440,6 @@ Enchantment_Drop_Rates:
         EPIC: 1.50
         EPIC: 1.50
         LEGENDARY: 0.75
         LEGENDARY: 0.75
 #
 #
-#  Settings for Excavation's Archaeology
-###
-Excavation:
-    CAKE:
-        Amount: 1
-        XP: 3000
-        Drop_Chance: 0.05
-        Drop_Level: 75
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
-    GUNPOWDER:
-        Amount: 1
-        XP: 30
-        Drop_Chance: 10.0
-        Drop_Level: 10
-        Drops_From: [Gravel]
-    BONE:
-        Amount: 1
-        XP: 30
-        Drop_Chance: 10.0
-        Drop_Level: 20
-        Drops_From: [Gravel]
-    APPLE:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 0.1
-        Drop_Level: 25
-        Drops_From: [Grass_Block, Mycelium]
-    SLIME_BALL:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 5.0
-        Drop_Level: 15
-        Drops_From: [Clay]
-    BUCKET:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 0.1
-        Drop_Level: 50
-        Drops_From: [Clay]
-    NETHERRACK:
-        Amount: 1
-        XP: 30
-        Drop_Chance: 0.5
-        Drop_Level: 85
-        Drops_From: [Gravel]
-    RED_MUSHROOM:
-        Amount: 1
-        XP: 80
-        Drop_Chance: 0.5
-        Drop_Level: 50
-        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
-    BROWN_MUSHROOM:
-        Amount: 1
-        XP: 80
-        Drop_Chance: 0.5
-        Drop_Level: 50
-        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
-    EGG:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 1.0
-        Drop_Level: 25
-        Drops_From: [Grass_Block]
-    SOUL_SAND:
-        Amount: 1
-        XP: 80
-        Drop_Chance: 0.5
-        Drop_Level: 65
-        Drops_From: [Sand, Red_Sand]
-    CLOCK:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 0.1
-        Drop_Level: 50
-        Drops_From: [Clay]
-    COBWEB:
-        Amount: 1
-        XP: 150
-        Drop_Chance: 5.0
-        Drop_Level: 75
-        Drops_From: [Clay]
-    STRING:
-        Amount: 1
-        XP: 200
-        Drop_Chance: 5.0
-        Drop_Level: 25
-        Drops_From: [Clay]
-    GLOWSTONE_DUST:
-        Amount: 1
-        XP: 80
-        Drop_Chance: 5.0
-        Drop_Level: 5
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Mycelium]
-    MUSIC_DISC_13:
-        Amount: 1
-        XP: 3000
-        Drop_Chance: 0.05
-        Drop_Level: 25
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
-    MUSIC_DISC_CAT:
-        Amount: 1
-        XP: 3000
-        Drop_Chance: 0.05
-        Drop_Level: 25
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
-    DIAMOND:
-        Amount: 1
-        XP: 1000
-        Drop_Chance: 0.13
-        Drop_Level: 35
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
-    COCOA_BEANS:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 1.33
-        Drop_Level: 35
-        Drops_From: [Dirt, Podzol, Grass_Block, Mycelium]
-    QUARTZ:
-        Amount: 1
-        XP: 100
-        Drop_Chance: 0.5
-        Drop_Level: 85
-        Drops_From: [Dirt, Podzol, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand]
-    NAME_TAG:
-        Amount: 1
-        XP: 3000
-        Drop_Chance: 0.05
-        Drop_Level: 25
-        Drops_From: [Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
-#
-#  Settings for Hylian Luck
-###
-Hylian_Luck:
-    MELON_SEEDS:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Bushes]
-    PUMPKIN_SEEDS:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Bushes]
-    COCOA_BEANS:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Bushes]
-    CARROT:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Flowers]
-    POTATO:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Flowers]
-    APPLE:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Flowers]
-    EMERALD:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Pots]
-    DIAMOND:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Pots]
-    GOLD_NUGGET:
-        Amount: 1
-        XP: 0
-        Drop_Chance: 100.0
-        Drop_Level: 0
-        Drops_From: [Pots]
-#
 #	Settings for Shake
 #	Settings for Shake
 ###
 ###
 Shake:
 Shake:

+ 58 - 0
src/main/resources/herbalism_treasures.yml

@@ -0,0 +1,58 @@
+#
+#  Settings for Hylian Luck
+###
+Hylian_Luck:
+    MELON_SEEDS:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Bushes]
+    PUMPKIN_SEEDS:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Bushes]
+    COCOA_BEANS:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Bushes]
+    CARROT:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Flowers]
+    POTATO:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Flowers]
+    APPLE:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Flowers]
+    EMERALD:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Pots]
+    DIAMOND:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Pots]
+    GOLD_NUGGET:
+        Amount: 1
+        XP: 0
+        Drop_Chance: 100.0
+        Drop_Level: 0
+        Drops_From: [Pots]