Browse Source

Update configurations and skill block checks to be more configurable.

t00thpick1 8 years ago
parent
commit
15436b44da

+ 23 - 165
src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java

@@ -9,7 +9,9 @@ import org.bukkit.TreeSpecies;
 import org.bukkit.entity.EntityType;
 import org.bukkit.entity.EntityType;
 import org.bukkit.material.LongGrass;
 import org.bukkit.material.LongGrass;
 import org.bukkit.material.MaterialData;
 import org.bukkit.material.MaterialData;
+import org.bukkit.material.Tree;
 
 
+import com.gmail.nossr50.mcMMO;
 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.MaterialType;
 import com.gmail.nossr50.datatypes.skills.MaterialType;
@@ -136,23 +138,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
             reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
             reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
         }
         }
 
 
-        /* Woodcutting */
-        for (TreeSpecies species : TreeSpecies.values()) {
-            String key = "Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_");
-
-            if (config.getInt(key) <= 0) {
-                reason.add(key + " should be greater than 0!");
-            }
-        }
-
-        if (getWoodcuttingXPHugeBrownMushroom() <= 0) {
-            reason.add("Experience.Woodcutting.Huge_Mushroom_Brown should be greater than 0!");
-        }
-
-        if (getWoodcuttingXPHugeRedMushroom() <= 0) {
-            reason.add("Experience.Woodcutting.Huge_Mushroom_Red should be greater than 0!");
-        }
-
         return noErrorsInConfig(reason);
         return noErrorsInConfig(reason);
     }
     }
 
 
@@ -207,7 +192,27 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
     public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
     public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
 
 
     /* Materials  */
     /* Materials  */
-    public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
+    public int getXp(SkillType skill, MaterialData data)
+    {
+        String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
+        String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data);
+        String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType());
+        mcMMO.p.debug(explicitString);
+        if (config.contains(explicitString))
+            return config.getInt(explicitString);
+        return config.getInt(noDataString, 0);
+    }
+    
+    public boolean isSkillBlock(SkillType skill, MaterialData data)
+    {
+        String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
+        String explicitString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data);
+        String noDataString = baseString + StringUtils.getPrettyItemString(data.getItemType());
+        mcMMO.p.debug(explicitString);
+        if (config.contains(explicitString))
+            return true;
+        return config.contains(noDataString);
+    }
 
 
     /* Acrobatics */
     /* Acrobatics */
     public int getDodgeXPModifier() { return config.getInt("Experience.Acrobatics.Dodge", 120); }
     public int getDodgeXPModifier() { return config.getInt("Experience.Acrobatics.Dodge", 120); }
@@ -222,149 +227,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
     /* Archery */
     /* Archery */
     public double getArcheryDistanceMultiplier() { return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025); }
     public double getArcheryDistanceMultiplier() { return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025); }
 
 
-    /* Excavation */
-    public int getDirtAndSandXp(MaterialData data) {
-        Material type = data.getItemType();
-
-        if (type == Material.DIRT) {
-            switch (data.getData()) {
-                case 0x0:
-                    return config.getInt("Experience.Excavation.Dirt", 40);
-
-                case 0x1:
-                    return config.getInt("Experience.Excavation.Coarse_Dirt", 40);
-
-                case 0x2:
-                    return config.getInt("Experience.Excavation.Podzol", 40);
-
-                default:
-                    return 0;
-            }
-        }
-        else if (type == Material.SAND) {
-            switch (data.getData()) {
-                case 0x0:
-                    return config.getInt("Experience.Excavation.Sand", 40);
-
-                case 0x1:
-                    return config.getInt("Experience.Excavation.Red_Sand", 40);
-
-                default:
-                    return 0;
-            }
-        }
-
-        return 0;
-    }
-
-    /* Fishing */
-    public int getFishXp(MaterialData data) {
-        switch (data.getData()) {
-            case 0x0:
-                return config.getInt("Experience.Fishing.Raw_Fish", 800);
-
-            case 0x1:
-                return config.getInt("Experience.Fishing.Raw_Salmon", 800);
-
-            case 0x2:
-                return config.getInt("Experience.Fishing.Clownfish", 800);
-
-            case 0x3:
-                return config.getInt("Experience.Fishing.Pufferfish", 800);
-
-            default:
-                return 0;
-        }
-    }
-
     public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
     public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
 
 
-    /* Herbalism */
-    public int getFlowerAndGrassXp(MaterialData data) {
-        Material type = data.getItemType();
-
-        if (type == Material.RED_ROSE) {
-            switch (data.getData()) {
-                case 0x0:
-                    return config.getInt("Experience.Herbalism.Poppy", 100);
-
-                case 0x1:
-                    return config.getInt("Experience.Herbalism.Blue_Orchid", 150);
-
-                case 0x2:
-                    return config.getInt("Experience.Herbalism.Allium", 300);
-
-                case 0x3:
-                    return config.getInt("Experience.Herbalism.Azure_Bluet", 150);
-
-                case 0x4:
-                    return config.getInt("Experience.Herbalism.Red_Tulip", 150);
-
-                case 0x5:
-                    return config.getInt("Experience.Herbalism.Orange_Tulip", 150);
-
-                case 0x6:
-                    return config.getInt("Experience.Herbalism.White_Tulip", 150);
-
-                case 0x7:
-                    return config.getInt("Experience.Herbalism.Pink_Tulip", 150);
-
-                case 0x8:
-                    return config.getInt("Experience.Herbalism.Oxeye_Daisy", 150);
-
-                default:
-                    return 0;
-            }
-
-        }
-        else if (type == Material.LONG_GRASS) {
-            GrassSpecies species = ((LongGrass) data).getSpecies();
-            if (species == null) {
-                return 0;
-            }
-
-            switch (species) {
-                case DEAD:
-                    return config.getInt("Experience.Herbalism.Dead_Bush", 30);
-
-                case FERN_LIKE:
-                    return config.getInt("Experience.Herbalism.Small_Fern", 10);
-
-                case NORMAL:
-                    return config.getInt("Experience.Herbalism.Small_Grass", 10);
-
-                default:
-                    return 0;
-            }
-        }
-        else if (type == Material.DOUBLE_PLANT) {
-            switch (data.getData()) {
-                case 0x0:
-                    return config.getInt("Experience.Herbalism.Sunflower", 50);
-
-                case 0x1:
-                    return config.getInt("Experience.Herbalism.Lilac", 50);
-
-                case 0x2:
-                    return config.getInt("Experience.Herbalism.Tall_Grass", 50);
-
-                case 0x3:
-                    return config.getInt("Experience.Herbalism.Tall_Fern", 50);
-
-                case 0x4:
-                    return config.getInt("Experience.Herbalism.Rose_Bush", 50);
-
-                case 0x5:
-                    return config.getInt("Experience.Herbalism.Peony", 50);
-
-                default:
-                    return 0;
-            }
-        }
-
-        return 0;
-    }
-
     /* Repair */
     /* Repair */
     public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
     public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
     public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
     public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
@@ -374,10 +238,4 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
     {
     {
         return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
         return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
     }
     }
-
-    /* Woodcutting */
-    public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
-    public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
-    public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
-
 }
 }

+ 7 - 48
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java

@@ -30,16 +30,7 @@ public class TreasureConfig extends ConfigLoader {
 
 
     private static TreasureConfig instance;
     private static TreasureConfig instance;
 
 
-    public List<ExcavationTreasure> excavationFromDirt     = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromGrass    = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromSand     = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromGravel   = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromClay     = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromMycel    = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromSnow     = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromRedSand  = new ArrayList<ExcavationTreasure>();
-    public List<ExcavationTreasure> excavationFromPodzol   = new ArrayList<ExcavationTreasure>();
+    public HashMap<Material, List<ExcavationTreasure>> excavationMap = new HashMap<Material, List<ExcavationTreasure>>();
 
 
     public List<HylianTreasure> hylianFromBushes  = new ArrayList<HylianTreasure>();
     public List<HylianTreasure> hylianFromBushes  = new ArrayList<HylianTreasure>();
     public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
     public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
@@ -385,44 +376,12 @@ public class TreasureConfig extends ConfigLoader {
                     ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
                     ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
                     List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
                     List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
 
 
-                    if (dropList.contains("Dirt")) {
-                        excavationFromDirt.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Grass")) {
-                        excavationFromGrass.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Sand")) {
-                        excavationFromSand.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Gravel")) {
-                        excavationFromGravel.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Clay")) {
-                        excavationFromClay.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Mycelium")) {
-                        excavationFromMycel.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Soul_Sand")) {
-                        excavationFromSoulSand.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Snow")) {
-                        excavationFromSnow.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Red_Sand")) {
-                        excavationFromRedSand.add(excavationTreasure);
-                    }
-
-                    if (dropList.contains("Podzol")) {
-                        excavationFromPodzol.add(excavationTreasure);
+                    for (String blockType : dropList)
+                    {
+                        Material mat = Material.matchMaterial(blockType);
+                        if (!excavationMap.containsKey(mat))
+                            excavationMap.put(mat, new ArrayList<ExcavationTreasure>());
+                        excavationMap.get(mat).add(excavationTreasure);
                     }
                     }
                 } else if (isHylian) {
                 } else if (isHylian) {
                     HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
                     HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);

+ 6 - 39
src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java

@@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.excavation;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
-import org.bukkit.Material;
 import org.bukkit.block.BlockState;
 import org.bukkit.block.BlockState;
 
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
@@ -11,6 +10,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
 import com.gmail.nossr50.config.treasure.TreasureConfig;
 import com.gmail.nossr50.config.treasure.TreasureConfig;
 import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
 import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
+import com.gmail.nossr50.util.StringUtils;
 
 
 public class Excavation {
 public class Excavation {
     /**
     /**
@@ -20,47 +20,14 @@ public class Excavation {
      * @return the list of treasures that could be found
      * @return the list of treasures that could be found
      */
      */
     protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
     protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
-        switch (blockState.getType()) {
-            case DIRT:
-                return blockState.getRawData() == 0x2 ? TreasureConfig.getInstance().excavationFromPodzol : TreasureConfig.getInstance().excavationFromDirt;
-
-            case GRASS:
-            case GRASS_PATH:
-                return TreasureConfig.getInstance().excavationFromGrass;
-
-            case SAND:
-                return blockState.getRawData() == 0x1 ? TreasureConfig.getInstance().excavationFromRedSand : TreasureConfig.getInstance().excavationFromSand;
-
-            case GRAVEL:
-                return TreasureConfig.getInstance().excavationFromGravel;
-
-            case CLAY:
-                return TreasureConfig.getInstance().excavationFromClay;
-
-            case MYCEL:
-                return TreasureConfig.getInstance().excavationFromMycel;
-
-            case SOUL_SAND:
-                return TreasureConfig.getInstance().excavationFromSoulSand;
-
-            case SNOW:
-                return TreasureConfig.getInstance().excavationFromSnow;
-
-            default:
-                return new ArrayList<ExcavationTreasure>();
-        }
+        String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData());
+        if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
+            return TreasureConfig.getInstance().excavationMap.get(friendly);
+        return new ArrayList<ExcavationTreasure>();
     }
     }
 
 
     protected static int getBlockXP(BlockState blockState) {
     protected static int getBlockXP(BlockState blockState) {
-        Material material = blockState.getType();
-        int xp;
-
-        if (material == Material.DIRT || material == Material.SAND) {
-            xp = ExperienceConfig.getInstance().getDirtAndSandXp(blockState.getData());
-        }
-        else {
-            xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, material);
-        }
+        int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getData());
 
 
         if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
         if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
             xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
             xp = mcMMO.getModManager().getBlock(blockState).getXpGain();

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java

@@ -300,7 +300,7 @@ public class FishingManager extends SkillManager {
      */
      */
     public void handleFishing(Item fishingCatch) {
     public void handleFishing(Item fishingCatch) {
         this.fishingCatch = fishingCatch;
         this.fishingCatch = fishingCatch;
-        int fishXp = ExperienceConfig.getInstance().getFishXp(fishingCatch.getItemStack().getData());
+        int fishXp = ExperienceConfig.getInstance().getXp(SkillType.FISHING, fishingCatch.getItemStack().getData());
         int treasureXp = 0;
         int treasureXp = 0;
         Player player = getPlayer();
         Player player = getPlayer();
         FishingTreasure treasure = null;
         FishingTreasure treasure = null;

+ 3 - 9
src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java

@@ -151,16 +151,10 @@ public class HerbalismManager extends SkillManager {
                 processGreenThumbPlants(blockState, greenTerra);
                 processGreenThumbPlants(blockState, greenTerra);
             }
             }
 
 
-            if (material == Material.DOUBLE_PLANT || material == Material.RED_ROSE || material == Material.LONG_GRASS) {
-                xp = ExperienceConfig.getInstance().getFlowerAndGrassXp(blockState.getData());
-            }
-            else {
-                if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) {
-                    return;
-                }
-                
-                xp = ExperienceConfig.getInstance().getXp(skill, material);
+            if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) {
+                return;
             }
             }
+            xp = ExperienceConfig.getInstance().getXp(skill, blockState.getData());
 
 
             if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
             if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
                 drops = blockState.getBlock().getDrops();
                 drops = blockState.getBlock().getDrops();

+ 1 - 2
src/main/java/com/gmail/nossr50/skills/mining/Mining.java

@@ -18,8 +18,7 @@ public class Mining {
      * @param blockState The {@link BlockState} to check ability activation for
      * @param blockState The {@link BlockState} to check ability activation for
      */
      */
     public static int getBlockXp(BlockState blockState) {
     public static int getBlockXp(BlockState blockState) {
-        Material blockType = blockState.getType();
-        int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);
+        int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getData());
 
 
         if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
         if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
             xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
             xp = mcMMO.getModManager().getBlock(blockState).getXpGain();

+ 2 - 3
src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java

@@ -48,8 +48,7 @@ public class Smelting {
 
 
     protected static int getResourceXp(ItemStack smelting) {
     protected static int getResourceXp(ItemStack smelting) {
         MaterialData data = smelting.getData();
         MaterialData data = smelting.getData();
-        Material resourceType = smelting.getType();
-
-        return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE);
+        
+        return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, data);
     }
     }
 }
 }

+ 2 - 19
src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java

@@ -15,6 +15,7 @@ import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.experience.ExperienceConfig;
 import com.gmail.nossr50.config.experience.ExperienceConfig;
+import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.util.BlockUtils;
 import com.gmail.nossr50.util.BlockUtils;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
@@ -40,29 +41,11 @@ public final class Woodcutting {
      * @return Amount of experience
      * @return Amount of experience
      */
      */
     protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
     protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
-        // Mushrooms aren't trees so we could never get species data from them
-        switch (blockState.getType()) {
-            case HUGE_MUSHROOM_1:
-                return ExperienceConfig.getInstance().getWoodcuttingXPHugeBrownMushroom();
-
-            case HUGE_MUSHROOM_2:
-                return ExperienceConfig.getInstance().getWoodcuttingXPHugeRedMushroom();
-
-            default:
-                break;
-        }
-
         if (mcMMO.getModManager().isCustomLog(blockState)) {
         if (mcMMO.getModManager().isCustomLog(blockState)) {
             return mcMMO.getModManager().getBlock(blockState).getXpGain();
             return mcMMO.getModManager().getBlock(blockState).getXpGain();
         }
         }
 
 
-        //TODO Remove this workaround when casting to Tree works again
-        TreeSpecies species = TreeSpecies.GENERIC;
-        if (blockState.getData() instanceof Tree) {
-            species = ((Tree) blockState.getData()).getSpecies();
-        }
-
-        return ExperienceConfig.getInstance().getWoodcuttingTreeXP(species);
+        return ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, blockState.getData());
     }
     }
 
 
     /**
     /**

+ 122 - 168
src/main/java/com/gmail/nossr50/util/BlockUtils.java

@@ -13,16 +13,20 @@ import org.bukkit.material.NetherWarts;
 import org.bukkit.material.SmoothBrick;
 import org.bukkit.material.SmoothBrick;
 
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.config.experience.ExperienceConfig;
+import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.skills.repair.Repair;
 import com.gmail.nossr50.skills.repair.Repair;
 import com.gmail.nossr50.skills.salvage.Salvage;
 import com.gmail.nossr50.skills.salvage.Salvage;
 
 
 public final class BlockUtils {
 public final class BlockUtils {
+
     private BlockUtils() {}
     private BlockUtils() {}
 
 
     /**
     /**
      * Checks to see if a given block awards XP.
      * Checks to see if a given block awards XP.
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block awards XP, false otherwise
      * @return true if the block awards XP, false otherwise
      */
      */
     public static boolean shouldBeWatched(BlockState blockState) {
     public static boolean shouldBeWatched(BlockState blockState) {
@@ -32,59 +36,61 @@ public final class BlockUtils {
     /**
     /**
      * Check if a given block should allow for the activation of abilities
      * Check if a given block should allow for the activation of abilities
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
-     * @return true if the block should allow ability activation, false otherwise
+     * @param blockState
+     *            The {@link BlockState} of the block to check
+     * @return true if the block should allow ability activation, false
+     *         otherwise
      */
      */
     public static boolean canActivateAbilities(BlockState blockState) {
     public static boolean canActivateAbilities(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case BED_BLOCK:
-            case BREWING_STAND:
-            case BOOKSHELF:
-            case BURNING_FURNACE:
-            case CAKE_BLOCK:
-            case CHEST:
-            case DISPENSER:
-            case ENCHANTMENT_TABLE:
-            case ENDER_CHEST:
-            case FENCE_GATE:
-            case ACACIA_FENCE_GATE:
-            case DARK_OAK_FENCE_GATE:
-            case SPRUCE_FENCE_GATE:
-            case BIRCH_FENCE_GATE:
-            case JUNGLE_FENCE_GATE:
-            case FURNACE:
-            case IRON_DOOR_BLOCK:
-            case JUKEBOX:
-            case LEVER:
-            case NOTE_BLOCK:
-            case STONE_BUTTON:
-            case WOOD_BUTTON:
-            case TRAP_DOOR:
-            case WALL_SIGN:
-            case WOODEN_DOOR:
-            case WORKBENCH:
-            case BEACON:
-            case ANVIL:
-            case DROPPER:
-            case HOPPER:
-            case TRAPPED_CHEST:
-            case IRON_DOOR:
-            case IRON_TRAPDOOR:
-            case ACACIA_DOOR:
-            case SPRUCE_DOOR:
-            case BIRCH_DOOR:
-            case JUNGLE_DOOR:
-            case DARK_OAK_DOOR:
-            case FENCE:
-            case ACACIA_FENCE:
-            case DARK_OAK_FENCE:
-            case BIRCH_FENCE:
-            case JUNGLE_FENCE:
-            case SPRUCE_FENCE:
-            case ARMOR_STAND:
+            case BED_BLOCK :
+            case BREWING_STAND :
+            case BOOKSHELF :
+            case BURNING_FURNACE :
+            case CAKE_BLOCK :
+            case CHEST :
+            case DISPENSER :
+            case ENCHANTMENT_TABLE :
+            case ENDER_CHEST :
+            case FENCE_GATE :
+            case ACACIA_FENCE_GATE :
+            case DARK_OAK_FENCE_GATE :
+            case SPRUCE_FENCE_GATE :
+            case BIRCH_FENCE_GATE :
+            case JUNGLE_FENCE_GATE :
+            case FURNACE :
+            case IRON_DOOR_BLOCK :
+            case JUKEBOX :
+            case LEVER :
+            case NOTE_BLOCK :
+            case STONE_BUTTON :
+            case WOOD_BUTTON :
+            case TRAP_DOOR :
+            case WALL_SIGN :
+            case WOODEN_DOOR :
+            case WORKBENCH :
+            case BEACON :
+            case ANVIL :
+            case DROPPER :
+            case HOPPER :
+            case TRAPPED_CHEST :
+            case IRON_DOOR :
+            case IRON_TRAPDOOR :
+            case ACACIA_DOOR :
+            case SPRUCE_DOOR :
+            case BIRCH_DOOR :
+            case JUNGLE_DOOR :
+            case DARK_OAK_DOOR :
+            case FENCE :
+            case ACACIA_FENCE :
+            case DARK_OAK_FENCE :
+            case BIRCH_FENCE :
+            case JUNGLE_FENCE :
+            case SPRUCE_FENCE :
+            case ARMOR_STAND :
                 return false;
                 return false;
 
 
-            default:
+            default :
                 return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState);
                 return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState);
         }
         }
     }
     }
@@ -92,7 +98,8 @@ public final class BlockUtils {
     /**
     /**
      * Check if a given block is an ore
      * Check if a given block is an ore
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block is an ore, false otherwise
      * @return true if the block is an ore, false otherwise
      */
      */
     public static boolean isOre(BlockState blockState) {
     public static boolean isOre(BlockState blockState) {
@@ -102,23 +109,24 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block can be made mossy
      * Determine if a given block can be made mossy
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block can be made mossy, false otherwise
      * @return true if the block can be made mossy, false otherwise
      */
      */
     public static boolean canMakeMossy(BlockState blockState) {
     public static boolean canMakeMossy(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case COBBLESTONE:
-            case DIRT:
-            case GRASS_PATH:
+            case COBBLESTONE :
+            case DIRT :
+            case GRASS_PATH :
                 return true;
                 return true;
 
 
-            case SMOOTH_BRICK:
+            case SMOOTH_BRICK :
                 return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
                 return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
 
 
-            case COBBLE_WALL:
+            case COBBLE_WALL :
                 return blockState.getRawData() == (byte) 0x0;
                 return blockState.getRawData() == (byte) 0x0;
 
 
-            default:
+            default :
                 return false;
                 return false;
         }
         }
     }
     }
@@ -126,134 +134,73 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block should be affected by Green Terra
      * Determine if a given block should be affected by Green Terra
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block should affected by Green Terra, false otherwise
      * @return true if the block should affected by Green Terra, false otherwise
      */
      */
     public static boolean affectedByGreenTerra(BlockState blockState) {
     public static boolean affectedByGreenTerra(BlockState blockState) {
-        switch (blockState.getType()) {
-            case BROWN_MUSHROOM:
-            case CACTUS:
-            case CHORUS_PLANT:
-            case CHORUS_FLOWER:
-            case DOUBLE_PLANT:
-            case MELON_BLOCK:
-            case LONG_GRASS:
-            case PUMPKIN:
-            case RED_MUSHROOM:
-            case RED_ROSE:
-            case SUGAR_CANE_BLOCK:
-            case VINE:
-            case WATER_LILY:
-            case YELLOW_FLOWER:
-                return true;
-
-            case BEETROOT_BLOCK:
-            case CARROT:
-            case POTATO:
-            case CROPS:
-                return ((Crops) blockState.getData()).getState() == CropState.RIPE;
-
-            case NETHER_WARTS:
-                return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
+        if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getData()))
+            return true;
 
 
-            case COCOA:
-                return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;
-
-            default:
-                return mcMMO.getModManager().isCustomHerbalismBlock(blockState);
-        }
+        return mcMMO.getModManager().isCustomHerbalismBlock(blockState);
     }
     }
 
 
     /**
     /**
      * Determine if a given block should be affected by Super Breaker
      * Determine if a given block should be affected by Super Breaker
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
-     * @return true if the block should affected by Super Breaker, false otherwise
+     * @param blockState
+     *            The {@link BlockState} of the block to check
+     * @return true if the block should affected by Super Breaker, false
+     *         otherwise
      */
      */
     public static Boolean affectedBySuperBreaker(BlockState blockState) {
     public static Boolean affectedBySuperBreaker(BlockState blockState) {
-        switch (blockState.getType()) {
-            case END_BRICKS:
-            case ENDER_STONE:
-            case GLOWSTONE:
-            case HARD_CLAY:
-            case MOSSY_COBBLESTONE:
-            case NETHERRACK:
-            case OBSIDIAN:
-            case PACKED_ICE:
-            case PURPUR_BLOCK:
-            case PURPUR_PILLAR:
-            case PURPUR_SLAB:
-            case PURPUR_STAIRS:
-            case SANDSTONE:
-            case STAINED_CLAY:
-            case STONE:
-            case PRISMARINE:
-            case RED_SANDSTONE:
-                
-                return true;
+        if (ExperienceConfig.getInstance().isSkillBlock(SkillType.MINING, blockState.getData()))
+            return true;
 
 
-            default:
-                return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState);
-        }
+        return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState);
     }
     }
 
 
     /**
     /**
      * Determine if a given block should be affected by Giga Drill Breaker
      * Determine if a given block should be affected by Giga Drill Breaker
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
-     * @return true if the block should affected by Giga Drill Breaker, false otherwise
+     * @param blockState
+     *            The {@link BlockState} of the block to check
+     * @return true if the block should affected by Giga Drill Breaker, false
+     *         otherwise
      */
      */
     public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
     public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
-        switch (blockState.getType()) {
-            case CLAY:
-            case DIRT:
-            case GRASS:
-            case GRASS_PATH:
-            case GRAVEL:
-            case MYCEL:
-            case SAND:
-            case SNOW:
-            case SNOW_BLOCK:
-            case SOUL_SAND:
-                return true;
-
-            default:
-                return mcMMO.getModManager().isCustomExcavationBlock(blockState);
-        }
+        if (ExperienceConfig.getInstance().isSkillBlock(SkillType.EXCAVATION, blockState.getData()))
+            return true;
+        return mcMMO.getModManager().isCustomExcavationBlock(blockState);
     }
     }
 
 
     /**
     /**
      * Check if a given block is a log
      * Check if a given block is a log
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block is a log, false otherwise
      * @return true if the block is a log, false otherwise
      */
      */
     public static boolean isLog(BlockState blockState) {
     public static boolean isLog(BlockState blockState) {
-        switch (blockState.getType()) {
-            case LOG:
-            case LOG_2:
-            case HUGE_MUSHROOM_1:
-            case HUGE_MUSHROOM_2:
-                return true;
-
-            default:
-                return mcMMO.getModManager().isCustomLog(blockState);
-        }
+        if (ExperienceConfig.getInstance().isSkillBlock(SkillType.WOODCUTTING, blockState.getData()))
+            return true;
+        return mcMMO.getModManager().isCustomLog(blockState);
     }
     }
 
 
     /**
     /**
      * Check if a given block is a leaf
      * Check if a given block is a leaf
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block is a leaf, false otherwise
      * @return true if the block is a leaf, false otherwise
      */
      */
     public static boolean isLeaves(BlockState blockState) {
     public static boolean isLeaves(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case LEAVES:
-            case LEAVES_2:
+            case LEAVES :
+            case LEAVES_2 :
                 return true;
                 return true;
 
 
-            default:
+            default :
                 return mcMMO.getModManager().isCustomLeaf(blockState);
                 return mcMMO.getModManager().isCustomLeaf(blockState);
         }
         }
     }
     }
@@ -261,16 +208,17 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block should be affected by Flux Mining
      * Determine if a given block should be affected by Flux Mining
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block should affected by Flux Mining, false otherwise
      * @return true if the block should affected by Flux Mining, false otherwise
      */
      */
     public static boolean affectedByFluxMining(BlockState blockState) {
     public static boolean affectedByFluxMining(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case IRON_ORE:
-            case GOLD_ORE:
+            case IRON_ORE :
+            case GOLD_ORE :
                 return true;
                 return true;
 
 
-            default:
+            default :
                 return false;
                 return false;
         }
         }
     }
     }
@@ -278,18 +226,20 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block can activate Herbalism abilities
      * Determine if a given block can activate Herbalism abilities
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
-     * @return true if the block can be activate Herbalism abilities, false otherwise
+     * @param blockState
+     *            The {@link BlockState} of the block to check
+     * @return true if the block can be activate Herbalism abilities, false
+     *         otherwise
      */
      */
     public static boolean canActivateHerbalism(BlockState blockState) {
     public static boolean canActivateHerbalism(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case DIRT:
-            case GRASS:
-            case GRASS_PATH:
-            case SOIL:
+            case DIRT :
+            case GRASS :
+            case GRASS_PATH :
+            case SOIL :
                 return false;
                 return false;
 
 
-            default:
+            default :
                 return true;
                 return true;
         }
         }
     }
     }
@@ -297,15 +247,17 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block should be affected by Block Cracker
      * Determine if a given block should be affected by Block Cracker
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
-     * @return true if the block should affected by Block Cracker, false otherwise
+     * @param blockState
+     *            The {@link BlockState} of the block to check
+     * @return true if the block should affected by Block Cracker, false
+     *         otherwise
      */
      */
     public static boolean affectedByBlockCracker(BlockState blockState) {
     public static boolean affectedByBlockCracker(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case SMOOTH_BRICK:
+            case SMOOTH_BRICK :
                 return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
                 return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
 
 
-            default:
+            default :
                 return false;
                 return false;
         }
         }
     }
     }
@@ -313,17 +265,18 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block can be made into Mycelium
      * Determine if a given block can be made into Mycelium
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block can be made into Mycelium, false otherwise
      * @return true if the block can be made into Mycelium, false otherwise
      */
      */
     public static boolean canMakeShroomy(BlockState blockState) {
     public static boolean canMakeShroomy(BlockState blockState) {
         switch (blockState.getType()) {
         switch (blockState.getType()) {
-            case DIRT:
-            case GRASS:
-            case GRASS_PATH:
+            case DIRT :
+            case GRASS :
+            case GRASS_PATH :
                 return true;
                 return true;
 
 
-            default:
+            default :
                 return false;
                 return false;
         }
         }
     }
     }
@@ -331,7 +284,8 @@ public final class BlockUtils {
     /**
     /**
      * Determine if a given block is an mcMMO anvil
      * Determine if a given block is an mcMMO anvil
      *
      *
-     * @param blockState The {@link BlockState} of the block to check
+     * @param blockState
+     *            The {@link BlockState} of the block to check
      * @return true if the block is an mcMMO anvil, false otherwise
      * @return true if the block is an mcMMO anvil, false otherwise
      */
      */
     public static boolean isMcMMOAnvil(BlockState blockState) {
     public static boolean isMcMMOAnvil(BlockState blockState) {

+ 304 - 15
src/main/java/com/gmail/nossr50/util/StringUtils.java

@@ -1,18 +1,30 @@
 package com.gmail.nossr50.util;
 package com.gmail.nossr50.util;
 
 
+import org.bukkit.CropState;
+import org.bukkit.GrassSpecies;
 import org.bukkit.Material;
 import org.bukkit.Material;
+import org.bukkit.NetherWartsState;
 import org.bukkit.TreeSpecies;
 import org.bukkit.TreeSpecies;
 import org.bukkit.entity.EntityType;
 import org.bukkit.entity.EntityType;
+import org.bukkit.material.CocoaPlant;
+import org.bukkit.material.Crops;
+import org.bukkit.material.LongGrass;
+import org.bukkit.material.MaterialData;
+import org.bukkit.material.NetherWarts;
+import org.bukkit.material.Tree;
+import org.bukkit.material.CocoaPlant.CocoaPlantSize;
 
 
 import com.gmail.nossr50.datatypes.party.PartyFeature;
 import com.gmail.nossr50.datatypes.party.PartyFeature;
 import com.gmail.nossr50.datatypes.skills.AbilityType;
 import com.gmail.nossr50.datatypes.skills.AbilityType;
 import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
 import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
 
 
 public class StringUtils {
 public class StringUtils {
+
     /**
     /**
      * Gets a capitalized version of the target string.
      * Gets a capitalized version of the target string.
      *
      *
-     * @param target String to capitalize
+     * @param target
+     *            String to capitalize
      * @return the capitalized string
      * @return the capitalized string
      */
      */
     public static String getCapitalized(String target) {
     public static String getCapitalized(String target) {
@@ -35,19 +47,296 @@ public class StringUtils {
         return createPrettyEnumString(species.toString());
         return createPrettyEnumString(species.toString());
     }
     }
 
 
+    public static String getFriendlyConfigMaterialDataString(MaterialData data) {
+        switch (data.getItemType()) {
+            case LOG :
+            case LOG_2 : {
+                TreeSpecies species = TreeSpecies.GENERIC;
+                if (data instanceof Tree) {
+                    Tree tree = (Tree) data;
+                    species = tree.getSpecies();
+                }
+                return createPrettyEnumString(species.name()).replace(" ", "_");
+            }
+            case LONG_GRASS : {
+                LongGrass grass = (LongGrass) data;
+                GrassSpecies species = grass.getSpecies();
+                switch (species) {
+                    case DEAD :
+                        return "Dead_Bush";
+
+                    case FERN_LIKE :
+                        return "Small_Fern";
+
+                    case NORMAL :
+                        return "Small_Grass";
+                }
+                break;
+            }
+            case RED_ROSE : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Poppy";
+
+                    case 0x1 :
+                        return "Blue_Orchid";
+
+                    case 0x2 :
+                        return "Allium";
+
+                    case 0x3 :
+                        return "Azure_Bluet";
+
+                    case 0x4 :
+                        return "Red_Tulip";
+
+                    case 0x5 :
+                        return "Orange_Tulip";
+
+                    case 0x6 :
+                        return "White_Tulip";
+
+                    case 0x7 :
+                        return "Pink_Tulip";
+
+                    case 0x8 :
+                        return "Oxeye_Daisy";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case DOUBLE_PLANT : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Sunflower";
+
+                    case 0x1 :
+                        return "Lilac";
+
+                    case 0x2 :
+                        return "Tall_Grass";
+
+                    case 0x3 :
+                        return "Tall_Fern";
+
+                    case 0x4 :
+                        return "Rose_Bush";
+
+                    case 0x5 :
+                        return "Peony";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case RAW_FISH : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Raw_Fish";
+
+                    case 0x1 :
+                        return "Raw_Salmon";
+
+                    case 0x2 :
+                        return "Clownfish";
+
+                    case 0x3 :
+                        return "Pufferfish";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case COOKED_FISH : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Cooked_Fish";
+
+                    case 0x1 :
+                        return "Cooked_Salmon";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case DIRT : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Dirt";
+
+                    case 0x1 :
+                        return "Coarse_Dirt";
+
+                    case 0x2 :
+                        return "Podzol";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case SAND : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Sand";
+
+                    case 0x1 :
+                        return "Red_Sand";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case QUARTZ_BLOCK : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Quartz_Block";
+
+                    case 0x1 :
+                        return "Chiseled_Quartz_Block";
+
+                    case 0x2 :
+                    case 0x3 :
+                    case 0x4 :
+                        return "Quartz_Pillar";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case SPONGE : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Sponge";
+
+                    case 0x1 :
+                        return "Wet_Sponge";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case PRISMARINE : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Prismarine";
+
+                    case 0x1 :
+                        return "Prismarine_Brick";
+
+                    case 0x2 :
+                        return "Dark_Prismarine";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case STONE : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Stone";
+
+                    case 0x1 :
+                        return "Granite";
+
+                    case 0x2 :
+                        return "Polished_Granite";
+
+                    case 0x3 :
+                        return "Diorite";
+
+                    case 0x4 :
+                        return "Polished_Diorite";
+
+                    case 0x5 :
+                        return "Andesite";
+
+                    case 0x6 :
+                        return "Polished_Andesite";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case WOOD : {
+                switch (data.getData()) {
+                    case 0x0 :
+                        return "Oak_Planks";
+
+                    case 0x1 :
+                        return "Spruce_Planks";
+
+                    case 0x2 :
+                        return "Birch_Planks";
+
+                    case 0x3 :
+                        return "Jungle_Planks";
+
+                    case 0x4 :
+                        return "Acacia_Planks";
+
+                    case 0x5 :
+                        return "Dark_Oak_Planks";
+
+                    default :
+                        return getExplicitConfigMaterialDataString(data);
+                }
+            }
+            case GLOWING_REDSTONE_ORE :
+                return getPrettyItemString(Material.REDSTONE_ORE).replace(" ", "_");
+
+            case BEETROOT_BLOCK :
+            case CARROT :
+            case POTATO :
+            case CROPS : {
+                if (((Crops) data).getState() == CropState.RIPE) {
+                    return getPrettyItemString(data.getItemType()).replace(" ", "_");
+                }
+                return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN";
+            }
+            case NETHER_WARTS : {
+                if (((NetherWarts) data).getState() == NetherWartsState.RIPE) {
+                    return getPrettyItemString(data.getItemType()).replace(" ", "_");
+                }
+                return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN";
+            }
+            case COCOA : {
+                if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) {
+                    return getPrettyItemString(data.getItemType()).replace(" ", "_");
+                }
+                return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN";
+            }
+            case SMOOTH_BRICK :
+            case WOOL :
+            case INK_SACK :
+            case STAINED_CLAY :
+            case STAINED_GLASS :
+            case FLOWER_POT :
+            case MONSTER_EGGS :
+                return getExplicitConfigMaterialDataString(data);
+            default :
+                break;
+        }
+        return getPrettyItemString(data.getItemType()).replace(" ", "_");
+    }
+
+    public static String getExplicitConfigMaterialDataString(MaterialData data) {
+        return StringUtils.getPrettyItemString(data.getItemType()).replace(" ", "_") + "|" + data.getData();
+    }
+
     public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) {
     public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) {
         switch (secondaryAbility) {
         switch (secondaryAbility) {
-            case HERBALISM_DOUBLE_DROPS:
-            case MINING_DOUBLE_DROPS:
-            case WOODCUTTING_DOUBLE_DROPS:
+            case HERBALISM_DOUBLE_DROPS :
+            case MINING_DOUBLE_DROPS :
+            case WOODCUTTING_DOUBLE_DROPS :
                 return "Double Drops";
                 return "Double Drops";
-            case FISHING_TREASURE_HUNTER:
-            case EXCAVATION_TREASURE_HUNTER:
+            case FISHING_TREASURE_HUNTER :
+            case EXCAVATION_TREASURE_HUNTER :
                 return "Treasure Hunter";
                 return "Treasure Hunter";
-            case GREEN_THUMB_BLOCK:
-            case GREEN_THUMB_PLANT:
+            case GREEN_THUMB_BLOCK :
+            case GREEN_THUMB_PLANT :
                 return "Green Thumb";
                 return "Green Thumb";
-            default:
+            default :
                 return createPrettyEnumString(secondaryAbility.toString());
                 return createPrettyEnumString(secondaryAbility.toString());
         }
         }
     }
     }
@@ -77,15 +366,15 @@ public class StringUtils {
     /**
     /**
      * Determine if a string represents an Integer
      * Determine if a string represents an Integer
      *
      *
-     * @param string String to check
+     * @param string
+     *            String to check
      * @return true if the string is an Integer, false otherwise
      * @return true if the string is an Integer, false otherwise
      */
      */
     public static boolean isInt(String string) {
     public static boolean isInt(String string) {
         try {
         try {
             Integer.parseInt(string);
             Integer.parseInt(string);
             return true;
             return true;
-        }
-        catch (NumberFormatException nFE) {
+        } catch (NumberFormatException nFE) {
             return false;
             return false;
         }
         }
     }
     }
@@ -93,15 +382,15 @@ public class StringUtils {
     /**
     /**
      * Determine if a string represents a Double
      * Determine if a string represents a Double
      *
      *
-     * @param string String to check
+     * @param string
+     *            String to check
      * @return true if the string is a Double, false otherwise
      * @return true if the string is a Double, false otherwise
      */
      */
     public static boolean isDouble(String string) {
     public static boolean isDouble(String string) {
         try {
         try {
             Double.parseDouble(string);
             Double.parseDouble(string);
             return true;
             return true;
-        }
-        catch (NumberFormatException nFE) {
+        } catch (NumberFormatException nFE) {
             return false;
             return false;
         }
         }
     }
     }

+ 4 - 2
src/main/resources/experience.yml

@@ -146,8 +146,8 @@ Experience:
         Generic: 70
         Generic: 70
         Jungle: 100
         Jungle: 100
         Redwood: 80
         Redwood: 80
-        Huge_Mushroom_Red: 70
-        Huge_Mushroom_Brown: 70
+        Huge_Mushroom_1: 70
+        Huge_Mushroom_2: 70
     Herbalism:
     Herbalism:
         Allium: 300
         Allium: 300
         Azure_Bluet: 150
         Azure_Bluet: 150
@@ -287,3 +287,5 @@ Experience:
             Ocelot: 1.0
             Ocelot: 1.0
             Villager: 1.0
             Villager: 1.0
             Snowman: 0.0
             Snowman: 0.0
+            Parrot: 1.0
+            Illusioner: 3.0