mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 17:23:42 +01:00 
			
		
		
		
	Fixed errors with block-based skill experience (#3506)
* Updated configs * [WIP] Replacing MaterialData with Blockdata * Fixed most block based experience gain * Fixed most block based experience gain & updated wooden_tools * Removed debug prints
This commit is contained in:
		 Shane Robertson
					Shane Robertson
				
			
				
					committed by
					
						 t00thpick1
						t00thpick1
					
				
			
			
				
	
			
			
			 t00thpick1
						t00thpick1
					
				
			
						parent
						
							210b418e44
						
					
				
				
					commit
					ee324c77a9
				
			| @@ -8,7 +8,7 @@ import org.bukkit.Material; | ||||
| import org.bukkit.TreeSpecies; | ||||
| import org.bukkit.entity.EntityType; | ||||
| import org.bukkit.material.LongGrass; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
| import org.bukkit.material.Tree; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -193,31 +193,32 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|     public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } | ||||
|  | ||||
|     /* Materials  */ | ||||
|     public int getXp(SkillType skill, MaterialData data) | ||||
|     public int getXp(SkillType skill, BlockData data) | ||||
|     { | ||||
|         System.out.print(">>YUP>"+skill.toString()); | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data); | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); | ||||
|         if (config.contains(explicitString)) | ||||
|             return config.getInt(explicitString); | ||||
|         String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); | ||||
|         String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data); | ||||
|         if (config.contains(friendlyString)) | ||||
|             return config.getInt(friendlyString); | ||||
|         String wildcardString = baseString + StringUtils.getWildcardConfigMaterialDataString(data); | ||||
|         String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data); | ||||
|         if (config.contains(wildcardString)) | ||||
|             return config.getInt(wildcardString); | ||||
|         return 0; | ||||
|     } | ||||
|      | ||||
|     public boolean isSkillBlock(SkillType skill, MaterialData data) | ||||
|     public boolean isSkillBlock(SkillType skill, BlockData data) | ||||
|     { | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigMaterialDataString(data); | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); | ||||
|         if (config.contains(explicitString)) | ||||
|             return true; | ||||
|         String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialDataString(data); | ||||
|         String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data); | ||||
|         if (config.contains(friendlyString)) | ||||
|             return true; | ||||
|         String wildcardString = baseString + StringUtils.getWildcardConfigMaterialDataString(data); | ||||
|         String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data); | ||||
|         if (config.contains(wildcardString)) | ||||
|             return true; | ||||
|         return false; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import java.util.Set; | ||||
|  | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.configuration.ConfigurationSection; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| import com.gmail.nossr50.config.ConfigLoader; | ||||
| import com.gmail.nossr50.datatypes.mods.CustomBlock; | ||||
| @@ -15,15 +15,15 @@ import com.gmail.nossr50.datatypes.mods.CustomBlock; | ||||
| public class CustomBlockConfig extends ConfigLoader { | ||||
|     private boolean needsUpdate = false; | ||||
|  | ||||
|     public List<MaterialData> customExcavationBlocks  = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customHerbalismBlocks   = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customMiningBlocks      = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customOres              = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customLogs              = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customLeaves            = new ArrayList<MaterialData>(); | ||||
|     public List<MaterialData> customAbilityBlocks     = new ArrayList<MaterialData>(); | ||||
|     public List<BlockData> customExcavationBlocks  = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customHerbalismBlocks   = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customMiningBlocks      = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customOres              = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customLogs              = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customLeaves            = new ArrayList<BlockData>(); | ||||
|     public List<BlockData> customAbilityBlocks     = new ArrayList<BlockData>(); | ||||
|  | ||||
|     public HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>(); | ||||
|     public HashMap<BlockData, CustomBlock> customBlockMap = new HashMap<BlockData, CustomBlock>(); | ||||
|  | ||||
|     protected CustomBlockConfig(String fileName) { | ||||
|         super("mods", fileName); | ||||
| @@ -44,7 +44,7 @@ public class CustomBlockConfig extends ConfigLoader { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void loadBlocks(String skillType, List<MaterialData> blockList) { | ||||
|     private void loadBlocks(String skillType, List<BlockData> blockList) { | ||||
|         if (needsUpdate) { | ||||
|             return; | ||||
|         } | ||||
| @@ -73,10 +73,10 @@ public class CustomBlockConfig extends ConfigLoader { | ||||
|             } | ||||
|  | ||||
|             byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0; | ||||
|             MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData); | ||||
|             BlockData blockBlockData = blockMaterial.createBlockData(); | ||||
|  | ||||
|             if (blockList != null) { | ||||
|                 blockList.add(blockMaterialData); | ||||
|                 blockList.add(blockBlockData); | ||||
|             } | ||||
|  | ||||
|             if (skillType.equals("Ability_Blocks")) { | ||||
| @@ -87,20 +87,20 @@ public class CustomBlockConfig extends ConfigLoader { | ||||
|             int smeltingXp = 0; | ||||
|  | ||||
|             if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) { | ||||
|                 customOres.add(blockMaterialData); | ||||
|                 customOres.add(blockBlockData); | ||||
|                 smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10); | ||||
|             } | ||||
|             else if (skillType.equals("Woodcutting")) { | ||||
|                 if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) { | ||||
|                     customLogs.add(blockMaterialData); | ||||
|                     customLogs.add(blockBlockData); | ||||
|                 } | ||||
|                 else { | ||||
|                     customLeaves.add(blockMaterialData); | ||||
|                     customLeaves.add(blockBlockData); | ||||
|                     xp = 0; // Leaves don't grant XP | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp)); | ||||
|             customBlockMap.put(blockBlockData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.config.mods; | ||||
| import java.util.HashMap; | ||||
|  | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| import com.gmail.nossr50.config.ConfigLoader; | ||||
| import com.gmail.nossr50.datatypes.mods.CustomEntity; | ||||
| @@ -54,7 +54,7 @@ public class CustomEntityConfig extends ConfigLoader { | ||||
|                 canBeSummoned = false; | ||||
|             } | ||||
|  | ||||
|             CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new MaterialData(callOfTheWildMaterial, callOfTheWildData).toItemStack(1) : null), callOfTheWildAmount); | ||||
|             CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new ItemStack(callOfTheWildMaterial) : null), callOfTheWildAmount); | ||||
|  | ||||
|             customEntityTypeMap.put(entityTypeName, entity); | ||||
|             customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity); | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| import org.bukkit.inventory.meta.PotionMeta; | ||||
| import org.bukkit.material.Dye; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
| import org.bukkit.potion.PotionData; | ||||
| import org.bukkit.potion.PotionType; | ||||
|  | ||||
| @@ -53,7 +53,6 @@ public class TreasureConfig extends ConfigLoader { | ||||
|     protected boolean validateKeys() { | ||||
|         // Validate all the settings! | ||||
|         List<String> reason = new ArrayList<String>(); | ||||
|  | ||||
|         for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) { | ||||
|             double totalEnchantDropRate = 0; | ||||
|             double totalItemDropRate = 0; | ||||
| @@ -136,7 +135,7 @@ public class TreasureConfig extends ConfigLoader { | ||||
|              */ | ||||
|             Material material; | ||||
|  | ||||
|             if (materialName.contains("INK_SACK")) { | ||||
|             if (materialName.contains("INK_SAC")) { | ||||
|                 material = Material.INK_SAC; | ||||
|             } else if (materialName.contains("COAL")) { | ||||
|                 material = Material.COAL; | ||||
| @@ -234,33 +233,33 @@ public class TreasureConfig extends ConfigLoader { | ||||
|                     } | ||||
|                     item.setItemMeta(itemMeta); | ||||
|                 } | ||||
|             } else if (materialName.contains("INK_SACK")) { | ||||
|                 String color = materialName.substring(9); | ||||
|  | ||||
|                 try { | ||||
|                     Dye dye = new Dye(); | ||||
|                     dye.setColor(DyeColor.valueOf(color.toUpperCase().trim())); | ||||
|  | ||||
|                     item = dye.toItemStack(amount); | ||||
|  | ||||
|                     if (config.contains(type + "." + treasureName + ".Custom_Name")) { | ||||
|                         ItemMeta itemMeta = item.getItemMeta(); | ||||
|                         itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name"))); | ||||
|                         item.setItemMeta(itemMeta); | ||||
|                     } | ||||
|  | ||||
|                     if (config.contains(type + "." + treasureName + ".Lore")) { | ||||
|                         ItemMeta itemMeta = item.getItemMeta(); | ||||
|                         List<String> lore = new ArrayList<String>(); | ||||
|                         for (String s : config.getStringList(type + "." + treasureName + ".Lore")) { | ||||
|                             lore.add(ChatColor.translateAlternateColorCodes('&', s)); | ||||
|                         } | ||||
|                         itemMeta.setLore(lore); | ||||
|                         item.setItemMeta(itemMeta); | ||||
|                     } | ||||
|                 } catch (IllegalArgumentException ex) { | ||||
|                     reason.add("Invalid Dye_Color: " + color); | ||||
|                 } | ||||
| //            } else if (materialName.contains("INK_SAC")) { | ||||
| //                String color = materialName.substring(9); | ||||
| // | ||||
| //                try { | ||||
| //                    Dye dye = new Dye(); | ||||
| //                    dye.setColor(DyeColor.valueOf(color.toUpperCase().trim())); | ||||
| // | ||||
| //                    item = dye.toItemStack(amount); | ||||
| // | ||||
| //                    if (config.contains(type + "." + treasureName + ".Custom_Name")) { | ||||
| //                        ItemMeta itemMeta = item.getItemMeta(); | ||||
| //                        itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name"))); | ||||
| //                        item.setItemMeta(itemMeta); | ||||
| //                    } | ||||
| // | ||||
| //                    if (config.contains(type + "." + treasureName + ".Lore")) { | ||||
| //                        ItemMeta itemMeta = item.getItemMeta(); | ||||
| //                        List<String> lore = new ArrayList<String>(); | ||||
| //                        for (String s : config.getStringList(type + "." + treasureName + ".Lore")) { | ||||
| //                            lore.add(ChatColor.translateAlternateColorCodes('&', s)); | ||||
| //                        } | ||||
| //                        itemMeta.setLore(lore); | ||||
| //                        item.setItemMeta(itemMeta); | ||||
| //                    } | ||||
| //                } catch (IllegalArgumentException ex) { | ||||
| //                    reason.add("Invalid Dye_Color: " + color); | ||||
| //                } | ||||
|             } else if (material != null) { | ||||
|                 item = new ItemStack(material, amount, data); | ||||
|  | ||||
| @@ -316,16 +315,40 @@ public class TreasureConfig extends ConfigLoader { | ||||
|                             continue; | ||||
|                         } | ||||
|                         if (dropper.equals("Flowers")) { | ||||
|                             for (int i = 0; i < 9; i++) { | ||||
|                                 AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.ROSE_RED, (byte) i)), hylianTreasure); | ||||
|                             } | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POPPY), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.DANDELION), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.BLUE_ORCHID), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.ALLIUM), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.AZURE_BLUET), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.ORANGE_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.PINK_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.RED_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.WHITE_TULIP), hylianTreasure); | ||||
|                             continue; | ||||
|                         } | ||||
|                         if (dropper.equals("Pots")) { | ||||
|                             for (int i = 0; i < 14; i++) { | ||||
|                                 AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.FLOWER_POT, (byte) i)), hylianTreasure); | ||||
|                             } | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.FLOWER_POT), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_DANDELION), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_POPPY), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_BLUE_ORCHID), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_ALLIUM), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_AZURE_BLUET), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_RED_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_ORANGE_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_WHITE_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_PINK_TULIP), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_OXEYE_DAISY), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_OAK_SAPLING), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_SPRUCE_SAPLING), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_BIRCH_SAPLING), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_JUNGLE_SAPLING), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_OXEYE_DAISY), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_OXEYE_DAISY), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_FERN), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_DEAD_BUSH), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_RED_MUSHROOM), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_BROWN_MUSHROOM), hylianTreasure); | ||||
|                             AddHylianTreasure(StringUtils.getPrettyItemString(Material.POTTED_CACTUS), hylianTreasure); | ||||
|                             continue; | ||||
|                         } | ||||
|                         AddHylianTreasure(dropper, hylianTreasure); | ||||
|   | ||||
| @@ -21,7 +21,7 @@ public enum MaterialType { | ||||
|                 return Material.LEATHER; | ||||
|  | ||||
|             case WOOD: | ||||
|                 return Material.OAK_PLANKS; | ||||
|                 return Material.OAK_WOOD; | ||||
|  | ||||
|             case STONE: | ||||
|                 return Material.COBBLESTONE; | ||||
|   | ||||
| @@ -216,7 +216,6 @@ public class BlockListener implements Listener { | ||||
|         /* WOOD CUTTING */ | ||||
|         else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|             WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager(); | ||||
|  | ||||
|             if (woodcuttingManager.canUseTreeFeller(heldItem)) { | ||||
|                 woodcuttingManager.processTreeFeller(blockState); | ||||
|             } | ||||
|   | ||||
| @@ -20,14 +20,14 @@ public class Excavation { | ||||
|      * @return the list of treasures that could be found | ||||
|      */ | ||||
|     protected static List<ExcavationTreasure> getTreasures(BlockState blockState) { | ||||
|         String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData()); | ||||
|         String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData()); | ||||
|         if (TreasureConfig.getInstance().excavationMap.containsKey(friendly)) | ||||
|             return TreasureConfig.getInstance().excavationMap.get(friendly); | ||||
|         return new ArrayList<ExcavationTreasure>(); | ||||
|     } | ||||
|  | ||||
|     protected static int getBlockXP(BlockState blockState) { | ||||
|         int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getData()); | ||||
|         int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getBlockData()); | ||||
|  | ||||
|         if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) { | ||||
|             xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
|   | ||||
| @@ -279,7 +279,7 @@ public class FishingManager extends SkillManager { | ||||
|      */ | ||||
|     public void handleFishing(Item fishingCatch) { | ||||
|         this.fishingCatch = fishingCatch; | ||||
|         int fishXp = ExperienceConfig.getInstance().getXp(SkillType.FISHING, fishingCatch.getItemStack().getData()); | ||||
|         int fishXp = ExperienceConfig.getInstance().getXp(SkillType.FISHING, fishingCatch.getItemStack().getType().createBlockData()); | ||||
|         int treasureXp = 0; | ||||
|         Player player = getPlayer(); | ||||
|         FishingTreasure treasure = null; | ||||
|   | ||||
| @@ -112,18 +112,22 @@ public class HerbalismManager extends SkillManager { | ||||
|      * @param blockState The {@link BlockState} to check ability activation for | ||||
|      */ | ||||
|     public void herbalismBlockCheck(BlockState blockState) { | ||||
|         System.out.print(">>1"); | ||||
|         Player player = getPlayer(); | ||||
|         Material material = blockState.getType(); | ||||
|         boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE); | ||||
|  | ||||
|         // Prevents placing and immediately breaking blocks for exp | ||||
|         if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|             System.out.print(">>1.5"); | ||||
|             return; | ||||
|         } | ||||
|         System.out.print(">>2"); | ||||
|          | ||||
|         if (!canBlockCheck()) { | ||||
|             return; | ||||
|         } | ||||
|         System.out.print(">>3"); | ||||
|  | ||||
|         Collection<ItemStack> drops = null; | ||||
|         int amount = 1; | ||||
| @@ -131,6 +135,7 @@ public class HerbalismManager extends SkillManager { | ||||
|         boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility()); | ||||
|  | ||||
|         if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) { | ||||
|             System.out.print(">>4"); | ||||
|             CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState); | ||||
|             xp = customBlock.getXpGain(); | ||||
|  | ||||
| @@ -139,28 +144,34 @@ public class HerbalismManager extends SkillManager { | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|             System.out.print(">>5"); | ||||
|             if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) { | ||||
|                 return; | ||||
|             } | ||||
|             xp = ExperienceConfig.getInstance().getXp(skill, blockState.getData()); | ||||
|             xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData()); | ||||
|  | ||||
|             if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) { | ||||
|                 drops = blockState.getBlock().getDrops(); | ||||
|                 System.out.print(">>6"); | ||||
|             } | ||||
|  | ||||
|             if (!oneBlockPlant) { | ||||
|                 System.out.print(">>7"); | ||||
|                 amount = Herbalism.calculateMultiBlockPlantDrops(blockState); | ||||
|                 xp *= amount; | ||||
|             } | ||||
|              | ||||
|             if (Permissions.greenThumbPlant(player, material)) { | ||||
|                 System.out.print(">>8"); | ||||
|                 processGreenThumbPlants(blockState, greenTerra); | ||||
|             } | ||||
|         } | ||||
|         System.out.print(">>9"); | ||||
|  | ||||
|         applyXpGain(xp, XPGainReason.PVE); | ||||
|  | ||||
|         if (drops == null) { | ||||
|             System.out.print(">>10"); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -199,7 +210,7 @@ public class HerbalismManager extends SkillManager { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData()); | ||||
|         String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData()); | ||||
|         if (!TreasureConfig.getInstance().hylianMap.containsKey(friendly)) | ||||
|             return false; | ||||
|         List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly); | ||||
| @@ -320,11 +331,11 @@ public class HerbalismManager extends SkillManager { | ||||
|  | ||||
|         switch (blockState.getType()) { | ||||
|  | ||||
|             case POTATO: | ||||
|             case CARROT: | ||||
|             case POTATOES: | ||||
|             case CARROTS: | ||||
|             case BEETROOTS: | ||||
|             case WHEAT: | ||||
|                 Crops crops = (Crops) blockState.getData(); | ||||
|                 Crops crops = (Crops) blockState.getBlockData(); | ||||
|  | ||||
|                 if (greenTerra) { | ||||
|                     crops.setState(CropState.MEDIUM); | ||||
| @@ -349,7 +360,7 @@ public class HerbalismManager extends SkillManager { | ||||
|                 return true; | ||||
|  | ||||
|             case NETHER_WART_BLOCK: | ||||
|                 NetherWarts warts = (NetherWarts) blockState.getData(); | ||||
|                 NetherWarts warts = (NetherWarts) blockState.getBlockData(); | ||||
|  | ||||
|                 if (greenTerra || greenThumbStage > 2) { | ||||
|                     warts.setState(NetherWartsState.STAGE_TWO); | ||||
| @@ -364,7 +375,7 @@ public class HerbalismManager extends SkillManager { | ||||
|                 return true; | ||||
|  | ||||
|             case COCOA: | ||||
|                 CocoaPlant plant = (CocoaPlant) blockState.getData(); | ||||
|                 CocoaPlant plant = (CocoaPlant) blockState.getBlockData(); | ||||
|  | ||||
|                 if (greenTerra || getGreenThumbStage() > 1) { | ||||
|                     plant.setSize(CocoaPlantSize.MEDIUM); | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.block.BlockState; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| public class Mining { | ||||
|  | ||||
| @@ -15,7 +16,7 @@ public class Mining { | ||||
|      * @param blockState The {@link BlockState} to check ability activation for | ||||
|      */ | ||||
|     public static int getBlockXp(BlockState blockState) { | ||||
|         int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getData()); | ||||
|         int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getBlockData()); | ||||
|  | ||||
|         if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) { | ||||
|             xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
| @@ -86,12 +87,12 @@ public class Mining { | ||||
|             case REDSTONE_ORE: | ||||
|             case STONE: | ||||
|             case PRISMARINE: | ||||
|                 Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1)); | ||||
|                 Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); | ||||
|                 return; | ||||
|  | ||||
|             default: | ||||
|                 if (mcMMO.getModManager().isCustomMiningBlock(blockState)) { | ||||
|                     Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1)); | ||||
|                     Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); | ||||
|                 } | ||||
|                 return; | ||||
|         } | ||||
|   | ||||
| @@ -16,6 +16,7 @@ import com.gmail.nossr50.util.EventUtils; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| import com.gmail.nossr50.util.Permissions; | ||||
| import com.gmail.nossr50.util.skills.SkillUtils; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.block.Block; | ||||
| import org.bukkit.block.BlockState; | ||||
| @@ -146,7 +147,7 @@ public class MiningManager extends SkillManager { | ||||
|                     xp += Mining.getBlockXp(blockState); | ||||
|                 } | ||||
|  | ||||
|                 Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1)); // Initial block that would have been dropped | ||||
|                 Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped | ||||
|  | ||||
|                 if (!mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|                     for (int i = 1; i < dropMultiplier; i++) { | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import org.bukkit.enchantments.Enchantment; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.PlayerInventory; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| import java.util.Map; | ||||
| import java.util.Map.Entry; | ||||
| @@ -89,7 +89,7 @@ public class RepairManager extends SkillManager { | ||||
|  | ||||
|         Material repairMaterial = repairable.getRepairMaterial(); | ||||
|         byte repairMaterialMetadata = repairable.getRepairMaterialMetadata(); | ||||
|         ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1); | ||||
|         ItemStack toRemove = new ItemStack(repairMaterial); | ||||
|  | ||||
|         short startDurability = item.getDurability(); | ||||
|  | ||||
|   | ||||
| @@ -20,7 +20,7 @@ import org.bukkit.enchantments.Enchantment; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.EnchantmentStorageMeta; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| import java.util.Map; | ||||
| import java.util.Map.Entry; | ||||
| @@ -108,9 +108,7 @@ public class SalvageManager extends SkillManager { | ||||
|             enchantBook = arcaneSalvageCheck(enchants); | ||||
|         } | ||||
|  | ||||
|         byte salvageMaterialMetadata = (salvageable.getSalvageMaterialMetadata() != (byte) -1) ? salvageable.getSalvageMaterialMetadata() : 0; | ||||
|  | ||||
|         ItemStack salvageResults = new MaterialData(salvageable.getSalvageMaterial(), salvageMaterialMetadata).toItemStack(salvageableAmount); | ||||
|         ItemStack salvageResults = new ItemStack(salvageable.getSalvageMaterial(), salvageableAmount); | ||||
|  | ||||
|         //Call event | ||||
|         if (EventUtils.callSalvageCheckEvent(player, item, salvageResults, enchantBook).isCancelled()) { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.smelting; | ||||
|  | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| @@ -47,7 +47,7 @@ public class Smelting { | ||||
|     public static double fluxMiningChance      = AdvancedConfig.getInstance().getFluxMiningChance(); | ||||
|  | ||||
|     protected static int getResourceXp(ItemStack smelting) { | ||||
|         MaterialData data = smelting.getData(); | ||||
|         BlockData data = smelting.getType().createBlockData(); | ||||
|          | ||||
|         return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, data); | ||||
|     } | ||||
|   | ||||
| @@ -21,7 +21,7 @@ import org.bukkit.entity.Item; | ||||
| import org.bukkit.entity.LivingEntity; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| public class UnarmedManager extends SkillManager { | ||||
|     public UnarmedManager(McMMOPlayer mcMMOPlayer) { | ||||
| @@ -59,7 +59,7 @@ public class UnarmedManager extends SkillManager { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         MaterialData data = blockState.getData(); | ||||
|         BlockData data = blockState.getBlockData(); | ||||
|  | ||||
|         switch (blockState.getType()) { | ||||
|             case STONE_BRICKS: | ||||
|   | ||||
| @@ -44,7 +44,7 @@ public final class Woodcutting { | ||||
|             return mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
|         } | ||||
|  | ||||
|         return ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, blockState.getData()); | ||||
|         return ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, blockState.getBlockData()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -45,6 +45,7 @@ public class WoodcuttingManager extends SkillManager { | ||||
|      * @param blockState Block being broken | ||||
|      */ | ||||
|     public void woodcuttingBlockCheck(BlockState blockState) { | ||||
|         System.out.print(">>HEYO"); | ||||
|         int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT); | ||||
|  | ||||
|         switch (blockState.getType()) { | ||||
|   | ||||
| @@ -134,7 +134,7 @@ public final class BlockUtils { | ||||
|      * @return true if the block is an ore, false otherwise | ||||
|      */ | ||||
|     public static boolean isOre(BlockState blockState) { | ||||
|         return MaterialUtils.isOre(blockState.getData()); | ||||
|         return MaterialUtils.isOre(blockState.getBlockData()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -170,8 +170,9 @@ public final class BlockUtils { | ||||
|      * @return true if the block should affected by Green Terra, false otherwise | ||||
|      */ | ||||
|     public static boolean affectedByGreenTerra(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getBlockData())) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         return mcMMO.getModManager().isCustomHerbalismBlock(blockState); | ||||
|     } | ||||
| @@ -185,7 +186,7 @@ public final class BlockUtils { | ||||
|      *         otherwise | ||||
|      */ | ||||
|     public static Boolean affectedBySuperBreaker(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.MINING, blockState.getData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.MINING, blockState.getBlockData())) | ||||
|             return true; | ||||
|  | ||||
|         return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState); | ||||
| @@ -200,7 +201,7 @@ public final class BlockUtils { | ||||
|      *         otherwise | ||||
|      */ | ||||
|     public static boolean affectedByGigaDrillBreaker(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.EXCAVATION, blockState.getData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.EXCAVATION, blockState.getBlockData())) | ||||
|             return true; | ||||
|         return mcMMO.getModManager().isCustomExcavationBlock(blockState); | ||||
|     } | ||||
| @@ -213,7 +214,7 @@ public final class BlockUtils { | ||||
|      * @return true if the block is a log, false otherwise | ||||
|      */ | ||||
|     public static boolean isLog(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.WOODCUTTING, blockState.getData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(SkillType.WOODCUTTING, blockState.getBlockData())) | ||||
|             return true; | ||||
|         return mcMMO.getModManager().isCustomLog(blockState); | ||||
|     } | ||||
|   | ||||
| @@ -511,7 +511,7 @@ public final class ItemUtils { | ||||
|     } | ||||
|  | ||||
|     public static boolean isSmeltable(ItemStack item) { | ||||
|         return item != null && MaterialUtils.isOre(item.getData()); | ||||
|         return item != null && MaterialUtils.isOre(item.getType().createBlockData()); | ||||
|     } | ||||
|  | ||||
|     public static boolean isSmelted(ItemStack item) { | ||||
| @@ -520,7 +520,7 @@ public final class ItemUtils { | ||||
|         } | ||||
|  | ||||
|         for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) { | ||||
|             if (recipe instanceof FurnaceRecipe && MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData())) { | ||||
|             if (recipe instanceof FurnaceRecipe && MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getType().createBlockData())) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
| @@ -681,18 +681,6 @@ public final class ItemUtils { | ||||
|             case JUNGLE_LOG: | ||||
|             case OAK_LOG: | ||||
|             case SPRUCE_LOG: | ||||
|             case OAK_WOOD: | ||||
|             case ACACIA_WOOD: | ||||
|             case BIRCH_WOOD: | ||||
|             case DARK_OAK_WOOD: | ||||
|             case STRIPPED_ACACIA_WOOD: | ||||
|             case JUNGLE_WOOD: | ||||
|             case SPRUCE_WOOD: | ||||
|             case STRIPPED_BIRCH_WOOD: | ||||
|             case STRIPPED_DARK_OAK_WOOD: | ||||
|             case STRIPPED_JUNGLE_WOOD: | ||||
|             case STRIPPED_OAK_WOOD: | ||||
|             case STRIPPED_SPRUCE_WOOD: | ||||
|             case STRIPPED_ACACIA_LOG: | ||||
|             case STRIPPED_BIRCH_LOG: | ||||
|             case STRIPPED_DARK_OAK_LOG: | ||||
|   | ||||
| @@ -1,13 +1,13 @@ | ||||
| package com.gmail.nossr50.util; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| public final class MaterialUtils { | ||||
|     private MaterialUtils() {} | ||||
|  | ||||
|     protected static boolean isOre(MaterialData data) { | ||||
|         switch (data.getItemType()) { | ||||
|     protected static boolean isOre(BlockData data) { | ||||
|         switch (data.getMaterial()) { | ||||
|             case COAL_ORE: | ||||
|             case DIAMOND_ORE: | ||||
|             case NETHER_QUARTZ_ORE: | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import org.bukkit.block.BlockState; | ||||
| import org.bukkit.configuration.file.YamlConfiguration; | ||||
| import org.bukkit.entity.Entity; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| @@ -33,14 +33,14 @@ public class ModManager { | ||||
|     private List<Material> customLeggings    = new ArrayList<Material>(); | ||||
|  | ||||
|     // Block Mods | ||||
|     private List<MaterialData> customExcavationBlocks  = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customHerbalismBlocks   = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customMiningBlocks      = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customOres              = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customLogs              = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customLeaves            = new ArrayList<MaterialData>(); | ||||
|     private List<MaterialData> customAbilityBlocks     = new ArrayList<MaterialData>(); | ||||
|     private HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>(); | ||||
|     private List<BlockData> customExcavationBlocks  = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customHerbalismBlocks   = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customMiningBlocks      = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customOres              = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customLogs              = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customLeaves            = new ArrayList<BlockData>(); | ||||
|     private List<BlockData> customAbilityBlocks     = new ArrayList<BlockData>(); | ||||
|     private HashMap<BlockData, CustomBlock> customBlockMap = new HashMap<BlockData, CustomBlock>(); | ||||
|  | ||||
|     // Entity Mods | ||||
|     private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>(); | ||||
| @@ -130,7 +130,7 @@ public class ModManager { | ||||
|         return Config.getInstance().getToolModsEnabled() && customSwords.contains(material); | ||||
|     } | ||||
|  | ||||
|     public boolean isCustomOre(MaterialData data) { | ||||
|     public boolean isCustomOre(BlockData data) { | ||||
|         return Config.getInstance().getBlockModsEnabled() && customOres.contains(data); | ||||
|     } | ||||
|  | ||||
| @@ -162,7 +162,7 @@ public class ModManager { | ||||
|         return customBlockMap.get(state.getData()); | ||||
|     } | ||||
|  | ||||
|     public CustomBlock getBlock(MaterialData data) { | ||||
|     public CustomBlock getBlock(BlockData data) { | ||||
|         return customBlockMap.get(data); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -5,8 +5,9 @@ import com.gmail.nossr50.datatypes.skills.AbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.SecondaryAbility; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.TreeSpecies; | ||||
| import org.bukkit.block.data.Ageable; | ||||
| import org.bukkit.entity.EntityType; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| public class StringUtils { | ||||
|  | ||||
| @@ -37,16 +38,32 @@ public class StringUtils { | ||||
|         return createPrettyEnumString(species.toString()); | ||||
|     } | ||||
|      | ||||
|     public static String getWildcardConfigMaterialDataString(MaterialData data) { | ||||
|         return StringUtils.getPrettyItemString(data.getItemType()).replace(" ", "_") + "|*"; | ||||
|     public static String getWildcardConfigBlockDataString(BlockData data) { | ||||
|         return StringUtils.getPrettyItemString(data.getMaterial()).replace(" ", "_") + "|*"; | ||||
|     } | ||||
|  | ||||
|     public static String getFriendlyConfigMaterialDataString(MaterialData data) { | ||||
|         return getPrettyItemString(data.getItemType()).replace(" ", "_"); | ||||
|     public static String getFriendlyConfigBlockDataString(BlockData data) { | ||||
|         switch(data.getMaterial()){ | ||||
|             case COCOA: | ||||
|             case WHEAT: | ||||
|             case BEETROOTS: | ||||
|             case CARROTS: | ||||
|             case POTATOES: | ||||
|             case NETHER_WART_BLOCK: { | ||||
|                 if (data instanceof Ageable) { | ||||
|                     Ageable ageData = (Ageable) data; | ||||
|                     if (ageData.getAge() == ageData.getMaximumAge()) { | ||||
|                         return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ripe"; | ||||
|                     } | ||||
|                 } | ||||
|                 return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ungrown"; | ||||
|             } | ||||
|         } | ||||
|         return getPrettyItemString(data.getMaterial()).replace(" ", "_"); | ||||
|     } | ||||
|  | ||||
|     public static String getExplicitConfigMaterialDataString(MaterialData data) { | ||||
|         return StringUtils.getPrettyItemString(data.getItemType()).replace(" ", "_") + "|" + data.getData(); | ||||
|     public static String getExplicitConfigBlockDataString(BlockData data) { | ||||
|         return StringUtils.getPrettyItemString(data.getMaterial()).replace(" ", "_"); | ||||
|     } | ||||
|  | ||||
|     public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ import org.bukkit.inventory.Recipe; | ||||
| import org.bukkit.inventory.ShapedRecipe; | ||||
| import org.bukkit.inventory.ShapelessRecipe; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| import org.bukkit.material.MaterialData; | ||||
| import org.bukkit.block.data.BlockData; | ||||
| import org.bukkit.potion.PotionEffect; | ||||
| import org.bukkit.potion.PotionEffectType; | ||||
|  | ||||
| @@ -255,7 +255,7 @@ public class SkillUtils { | ||||
|             return Material.COBBLESTONE; | ||||
|         } | ||||
|         else if (ItemUtils.isWoodTool(inHand)) { | ||||
|             return Material.OAK_PLANKS; | ||||
|             return Material.OAK_WOOD; | ||||
|         } | ||||
|         else if (ItemUtils.isLeatherArmor(inHand)) { | ||||
|             return Material.LEATHER; | ||||
| @@ -278,7 +278,7 @@ public class SkillUtils { | ||||
|         item.setDurability((short) 0); | ||||
|  | ||||
|         int quantity = 0; | ||||
|         MaterialData repairData = repairMaterial != null ? new MaterialData(repairMaterial, repairMetadata) : null; | ||||
|         BlockData repairData = repairMaterial != null ? repairMaterial.createBlockData() : null; | ||||
|         List<Recipe> recipes = mcMMO.p.getServer().getRecipesFor(item); | ||||
|  | ||||
|         if (recipes.isEmpty()) { | ||||
| @@ -289,14 +289,14 @@ public class SkillUtils { | ||||
|  | ||||
|         if (recipe instanceof ShapelessRecipe) { | ||||
|             for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) { | ||||
|                 if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) { | ||||
|                 if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getType().equals(repairData))) { | ||||
|                     quantity += ingredient.getAmount(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         else if (recipe instanceof ShapedRecipe) { | ||||
|             for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) { | ||||
|                 if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) { | ||||
|                 if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getType().equals(repairData))) { | ||||
|                     quantity += ingredient.getAmount(); | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -376,7 +376,7 @@ Skills: | ||||
|                 Summon_Length: 240 | ||||
|                 Summon_Max_Amount: 10 | ||||
|             Ocelot: | ||||
|                 Item_Material: RAW_FISH | ||||
|                 Item_Material: COD | ||||
|                 Item_Amount: 10 | ||||
|                 Summon_Amount: 1 | ||||
|                 Summon_Length: 240 | ||||
|   | ||||
| @@ -140,48 +140,54 @@ Experience: | ||||
|         Snow_Block: 40 | ||||
|         Soul_Sand: 40 | ||||
|     Woodcutting: | ||||
|         Acacia: 90 | ||||
|         Birch: 90 | ||||
|         Dark_Oak: 90 | ||||
|         Generic: 70 | ||||
|         Jungle: 100 | ||||
|         Redwood: 80 | ||||
|         Oak_Log: 70 | ||||
|         Spruce_Log: 80 | ||||
|         Birch_Log: 90 | ||||
|         Jungle_Log: 100 | ||||
|         Acacia_Log: 90 | ||||
|         Dark_Oak_Log: 90 | ||||
|         Stripped_Oak_Log: 70 | ||||
|         Stripped_Spruce_Log: 80 | ||||
|         Stripped_Birch_Log: 90 | ||||
|         Stripped_Jungle_Log: 100 | ||||
|         Stripped_Acacia_Log: 90 | ||||
|         Stripped_Dark_Oak_Log: 90 | ||||
|         Huge_Mushroom_1: 70 | ||||
|         Huge_Mushroom_2: 70 | ||||
|     Herbalism: | ||||
|         Allium: 300 | ||||
|         Azure_Bluet: 150 | ||||
|         Beetroot_Block_Ripe: 50 | ||||
|         Beetroots_Ripe: 50 | ||||
|         Blue_Orchid: 150 | ||||
|         Brown_Mushroom: 150 | ||||
|         Cactus: 30 | ||||
|         Carrot_Ripe: 50 | ||||
|         Carrots_Ripe: 50 | ||||
|         Chorus_Flower: 25 | ||||
|         Chorus_Plant: 1 | ||||
|         Cocoa_Ripe: 30 | ||||
|         Crops_Ripe: 50 | ||||
|         Wheat_Ripe: 50 | ||||
|         Dead_Bush: 30 | ||||
|         Lilac: 50 | ||||
|         Melon_Block: 20 | ||||
|         Nether_Warts_Ripe: 50 | ||||
|         Nether_Wart_Ripe: 50 | ||||
|         Orange_Tulip: 150 | ||||
|         Oxeye_Daisy: 150 | ||||
|         Peony: 50 | ||||
|         Pink_Tulip: 150 | ||||
|         Poppy: 100 | ||||
|         Potato_Ripe: 50 | ||||
|         Potatoes_Ripe: 50 | ||||
|         Pumpkin: 20 | ||||
|         Red_Mushroom: 150 | ||||
|         Red_Tulip: 150 | ||||
|         Rose_Bush: 50 | ||||
|         Small_Fern: 10 | ||||
|         Small_Grass: 10 | ||||
|         Fern: 10 | ||||
|         Grass: 10 | ||||
|         Sugar_Cane_Block: 30 | ||||
|         Sunflower: 50 | ||||
|         Tall_Grass: 50 | ||||
|         Tall_Fern: 50 | ||||
|         Large_Fern: 50 | ||||
|         Vine: 10 | ||||
|         Water_Lily: 100 | ||||
|         Lily_Pad: 100 | ||||
|         White_Tulip: 150 | ||||
|         Dandelion: 100 | ||||
|     Mining: | ||||
|   | ||||
| @@ -46,19 +46,19 @@ Repairables: | ||||
|     # Wooden repairables | ||||
|     ### | ||||
|     # Tools | ||||
|     WOOD_SWORD: | ||||
|     WOODEN_SWORD: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .25 | ||||
|     WOOD_SHOVEL: | ||||
|     WOODEN_SHOVEL: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .16 | ||||
|     WOOD_PICKAXE: | ||||
|     WOODEN_PICKAXE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .5 | ||||
|     WOOD_AXE: | ||||
|     WOODEN_AXE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .5 | ||||
|     WOOD_HOE: | ||||
|     WOODEN_HOE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .25 | ||||
|     # | ||||
|   | ||||
| @@ -46,19 +46,19 @@ Salvageables: | ||||
|     # Wooden salvageables | ||||
|     ### | ||||
|     # Tools | ||||
|     WOOD_SWORD: | ||||
|     WOODEN_SWORD: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .25 | ||||
|     WOOD_SHOVEL: | ||||
|     WOODEN_SHOVEL: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .16 | ||||
|     WOOD_PICKAXE: | ||||
|     WOODEN_PICKAXE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .5 | ||||
|     WOOD_AXE: | ||||
|     WOODEN_AXE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .5 | ||||
|     WOOD_HOE: | ||||
|     WOODEN_HOE: | ||||
|         MinimumLevel: 0 | ||||
|         XpMultiplier: .25 | ||||
|     # | ||||
|   | ||||
| @@ -39,7 +39,6 @@ Fishing: | ||||
|         Amount: 1 | ||||
|         XP: 200 | ||||
|         Rarity: COMMON | ||||
|       //!! | ||||
|     LAPIS_LAZULI: | ||||
|         Amount: 20 | ||||
|         XP: 200 | ||||
| @@ -773,7 +772,7 @@ Shake: | ||||
|             XP: 0 | ||||
|             Drop_Chance: 30.0 | ||||
|             Drop_Level: 0 | ||||
|         RAW_BEEF: | ||||
|         BEEF: | ||||
|             Amount: 1 | ||||
|             XP: 0 | ||||
|             Drop_Chance: 30.0 | ||||
| @@ -867,7 +866,7 @@ Shake: | ||||
|             XP: 0 | ||||
|             Drop_Chance: 3.0 | ||||
|             Drop_Level: 0 | ||||
|         SNOW_BALL: | ||||
|         SNOWBALL: | ||||
|             Amount: 2 | ||||
|             XP: 0 | ||||
|             Drop_Chance: 97.0 | ||||
|   | ||||
| @@ -379,7 +379,7 @@ public class PotionConfigGenerator { | ||||
|                 children.put(new Ingredient(Material.RABBIT_FOOT), new WriteablePotion(current.mat, PotionType.JUMP)); | ||||
|                 children.put(new Ingredient(Material.MAGMA_CREAM), new WriteablePotion(current.mat, PotionType.FIRE_RESISTANCE)); | ||||
|                 children.put(new Ingredient(Material.SUGAR), new WriteablePotion(current.mat, PotionType.SPEED)); | ||||
|                 children.put(new Ingredient(Material.RAW_FISH, 3), new WriteablePotion(current.mat, PotionType.WATER_BREATHING)); | ||||
|                 children.put(new Ingredient(Material.COD, 3), new WriteablePotion(current.mat, PotionType.WATER_BREATHING)); | ||||
|                 children.put(new Ingredient(Material.SPECKLED_MELON), new WriteablePotion(current.mat, PotionType.INSTANT_HEAL)); | ||||
|                 children.put(new Ingredient(Material.SPIDER_EYE), new WriteablePotion(current.mat, PotionType.POISON)); | ||||
|                 children.put(new Ingredient(Material.GHAST_TEAR), new WriteablePotion(current.mat, PotionType.REGEN)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user