diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 98c590d5d..9906de585 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -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) { 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) { + System.out.print(">>\n\n"+config.toString()+"\n\n<<"); 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; diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java index 9a754a929..df11ac212 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java @@ -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 customExcavationBlocks = new ArrayList(); - public List customHerbalismBlocks = new ArrayList(); - public List customMiningBlocks = new ArrayList(); - public List customOres = new ArrayList(); - public List customLogs = new ArrayList(); - public List customLeaves = new ArrayList(); - public List customAbilityBlocks = new ArrayList(); + public List customExcavationBlocks = new ArrayList(); + public List customHerbalismBlocks = new ArrayList(); + public List customMiningBlocks = new ArrayList(); + public List customOres = new ArrayList(); + public List customLogs = new ArrayList(); + public List customLeaves = new ArrayList(); + public List customAbilityBlocks = new ArrayList(); - public HashMap customBlockMap = new HashMap(); + public HashMap customBlockMap = new HashMap(); protected CustomBlockConfig(String fileName) { super("mods", fileName); @@ -44,7 +44,7 @@ public class CustomBlockConfig extends ConfigLoader { } } - private void loadBlocks(String skillType, List blockList) { + private void loadBlocks(String skillType, List 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)); } } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java index 16be6e00e..218827c0a 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java @@ -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); diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 3c506dcd0..f770ca002 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -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 reason = new ArrayList(); - for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) { double totalEnchantDropRate = 0; double totalItemDropRate = 0; @@ -234,33 +233,33 @@ public class TreasureConfig extends ConfigLoader { } item.setItemMeta(itemMeta); } - } 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 lore = new ArrayList(); - 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 lore = new ArrayList(); +// 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); diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 97978a051..7481d4d72 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -191,10 +191,12 @@ public class BlockListener implements Listener { /* HERBALISM */ if (BlockUtils.affectedByGreenTerra(blockState)) { + System.out.println(">>This Shit"); HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager(); /* Green Terra */ if (herbalismManager.canActivateAbility()) { + System.out.println(">>Sucks big ol"); mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM); } @@ -203,6 +205,7 @@ public class BlockListener implements Listener { * Instead, we check it inside the drops handler. */ if (SkillType.HERBALISM.getPermissions(player)) { + System.out.println(">>Pee pee"); herbalismManager.herbalismBlockCheck(blockState); } } diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java index bdd7590c0..5771866b8 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java @@ -20,14 +20,16 @@ public class Excavation { * @return the list of treasures that could be found */ protected static List getTreasures(BlockState blockState) { - String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData()); + System.out.print(">>4"); + String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData()); if (TreasureConfig.getInstance().excavationMap.containsKey(friendly)) return TreasureConfig.getInstance().excavationMap.get(friendly); return new ArrayList(); } protected static int getBlockXP(BlockState blockState) { - int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getData()); + System.out.print(">>5"); + int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getBlockData()); if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) { xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 923daa920..cdc97ca3a 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -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; diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 7f77d9dd5..3ab74c2f2 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -142,7 +142,7 @@ public class HerbalismManager extends SkillManager { 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(); @@ -199,7 +199,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 treasures = TreasureConfig.getInstance().hylianMap.get(friendly); @@ -324,7 +324,7 @@ public class HerbalismManager extends SkillManager { case CARROT: case BEETROOTS: case WHEAT: - Crops crops = (Crops) blockState.getData(); + Crops crops = (Crops) blockState.getBlockData(); if (greenTerra) { crops.setState(CropState.MEDIUM); @@ -349,7 +349,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 +364,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); diff --git a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java index 92f74f696..7445db8af 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -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; } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 12c1dcc9c..05b91da66 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -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++) { diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index 07374f903..5716cfe86 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -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(); diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index ab7efb3f8..c529638d3 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -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()) { diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java b/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java index b0695ec8a..0ee84d598 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java @@ -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); } diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 443c2f4ce..976aed4e5 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -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: diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java index 8d3fe4070..307840b60 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java @@ -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()); } /** diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index d092e3eb9..e8002f61f 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -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,11 @@ 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())) + System.out.print(">>Fuckin hell dude"); + if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getBlockData())) { + System.out.print(">>Does it work?"); return true; + } return mcMMO.getModManager().isCustomHerbalismBlock(blockState); } @@ -185,7 +188,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 +203,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 +216,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); } diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index 08aac96cc..8276e4c2a 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -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; } } diff --git a/src/main/java/com/gmail/nossr50/util/MaterialUtils.java b/src/main/java/com/gmail/nossr50/util/MaterialUtils.java index 28ffab8bb..108ea31c9 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialUtils.java @@ -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: diff --git a/src/main/java/com/gmail/nossr50/util/ModManager.java b/src/main/java/com/gmail/nossr50/util/ModManager.java index 87ef1acb7..16239bee6 100644 --- a/src/main/java/com/gmail/nossr50/util/ModManager.java +++ b/src/main/java/com/gmail/nossr50/util/ModManager.java @@ -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 customLeggings = new ArrayList(); // Block Mods - private List customExcavationBlocks = new ArrayList(); - private List customHerbalismBlocks = new ArrayList(); - private List customMiningBlocks = new ArrayList(); - private List customOres = new ArrayList(); - private List customLogs = new ArrayList(); - private List customLeaves = new ArrayList(); - private List customAbilityBlocks = new ArrayList(); - private HashMap customBlockMap = new HashMap(); + private List customExcavationBlocks = new ArrayList(); + private List customHerbalismBlocks = new ArrayList(); + private List customMiningBlocks = new ArrayList(); + private List customOres = new ArrayList(); + private List customLogs = new ArrayList(); + private List customLeaves = new ArrayList(); + private List customAbilityBlocks = new ArrayList(); + private HashMap customBlockMap = new HashMap(); // Entity Mods private HashMap customEntityClassMap = new HashMap(); @@ -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); } diff --git a/src/main/java/com/gmail/nossr50/util/StringUtils.java b/src/main/java/com/gmail/nossr50/util/StringUtils.java index f7ceb9ad2..a1a9b4715 100644 --- a/src/main/java/com/gmail/nossr50/util/StringUtils.java +++ b/src/main/java/com/gmail/nossr50/util/StringUtils.java @@ -6,7 +6,7 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import org.bukkit.Material; import org.bukkit.TreeSpecies; import org.bukkit.entity.EntityType; -import org.bukkit.material.MaterialData; +import org.bukkit.block.data.BlockData; public class StringUtils { @@ -37,16 +37,16 @@ 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) { + 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) { diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 3e0183c36..7954ed569 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -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; @@ -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 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(); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e2f6e9660..171d5c7b6 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -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 diff --git a/src/main/resources/repair.vanilla.yml b/src/main/resources/repair.vanilla.yml index a270791ab..f228633c8 100644 --- a/src/main/resources/repair.vanilla.yml +++ b/src/main/resources/repair.vanilla.yml @@ -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 # diff --git a/src/main/resources/salvage.vanilla.yml b/src/main/resources/salvage.vanilla.yml index c7d943203..37f92729d 100644 --- a/src/main/resources/salvage.vanilla.yml +++ b/src/main/resources/salvage.vanilla.yml @@ -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 # diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index 6d5bb8bd1..2dd3d0459 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -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 diff --git a/src/util/java/mcMMO/PotionConfigGenerator.java b/src/util/java/mcMMO/PotionConfigGenerator.java index e592a731f..30e1d96a9 100644 --- a/src/util/java/mcMMO/PotionConfigGenerator.java +++ b/src/util/java/mcMMO/PotionConfigGenerator.java @@ -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));