Take a player, not an item. Also avoids potential for NPE.

This commit is contained in:
GJ 2013-02-16 11:34:39 -05:00
parent 4071f259ad
commit 6f96a5026b

View File

@ -439,7 +439,7 @@ public class SkillTools {
player.setCanPickupItems(false); player.setCanPickupItems(false);
} }
else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { 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; 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); int efficiencyLevel = heldItem.getEnchantmentLevel(Enchantment.DIG_SPEED);
ItemMeta itemMeta = heldItem.getItemMeta(); ItemMeta itemMeta = heldItem.getItemMeta();
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();