From 6f96a5026b69de66e32b6f3a8243938ea383ef58 Mon Sep 17 00:00:00 2001 From: GJ Date: Sat, 16 Feb 2013 11:34:39 -0500 Subject: [PATCH] Take a player, not an item. Also avoids potential for NPE. --- .../com/gmail/nossr50/skills/utilities/SkillTools.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 0c9be1217..1bc77aa28 100644 --- a/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java +++ b/src/main/java/com/gmail/nossr50/skills/utilities/SkillTools.java @@ -439,7 +439,7 @@ public class SkillTools { player.setCanPickupItems(false); } else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { - handleAbilitySpeedIncrease(player.getItemInHand()); + handleAbilitySpeedIncrease(player); } } } @@ -524,7 +524,13 @@ public class SkillTools { return skillLevel; } - public static void handleAbilitySpeedIncrease(ItemStack heldItem) { + public static void handleAbilitySpeedIncrease(Player player) { + ItemStack heldItem = player.getItemInHand(); + + if (heldItem == null || heldItem.getType() == Material.AIR ) { + return; + } + int efficiencyLevel = heldItem.getEnchantmentLevel(Enchantment.DIG_SPEED); ItemMeta itemMeta = heldItem.getItemMeta(); List itemLore = new ArrayList();