From 01e26f321da0c8ae9e380a758817ac75b1e85755 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 14 Feb 2013 14:35:53 -0500 Subject: [PATCH] Fix issues with enchant-based Superbreaker implementation. --- .../nossr50/skills/utilities/SkillTools.java | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java b/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java index 7306df1a6..ce5ec06ad 100644 --- a/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java +++ b/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.skills.utilities; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.bukkit.block.Block; @@ -553,25 +552,18 @@ public class SkillTools { int efficiencyLevel = item.getEnchantmentLevel(Enchantment.DIG_SPEED); List itemLore = itemMeta.getLore(); - for (Iterator loreIterator = itemLore.iterator(); loreIterator.hasNext();) { - String lore = loreIterator.next(); - - if (lore.equalsIgnoreCase("mcMMO Ability Tool")) { - loreIterator.remove(); - break; + if (itemLore.remove("mcMMO Ability Tool")) { + if (efficiencyLevel <= 5) { + item.removeEnchantment(Enchantment.DIG_SPEED); + } + else { + itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - 5, true); } - } - if (efficiencyLevel == 5) { - item.removeEnchantment(Enchantment.DIG_SPEED); + itemMeta.setLore(itemLore); + item.setItemMeta(itemMeta); + return; } - else { - itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - 5, true); - } - - itemMeta.setLore(itemLore); - item.setItemMeta(itemMeta); - return; } } }