Things in inventory can be null.

This commit is contained in:
GJ 2013-02-14 16:02:42 -05:00
parent 1b814b937b
commit 615288e635
2 changed files with 9 additions and 0 deletions

View File

@ -79,6 +79,10 @@ public class PlayerListener implements Listener {
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) { if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
for (ItemStack item : event.getDrops()) { for (ItemStack item : event.getDrops()) {
if (item == null || item.getType() == Material.AIR ) {
continue;
}
if (item.containsEnchantment(Enchantment.DIG_SPEED)) { if (item.containsEnchantment(Enchantment.DIG_SPEED)) {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.utilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -545,6 +546,10 @@ public class SkillTools {
PlayerInventory playerInventory = player.getInventory(); PlayerInventory playerInventory = player.getInventory();
for (ItemStack item : playerInventory.getContents()) { for (ItemStack item : playerInventory.getContents()) {
if (item == null || item.getType() == Material.AIR ) {
continue;
}
if (item.containsEnchantment(Enchantment.DIG_SPEED)) { if (item.containsEnchantment(Enchantment.DIG_SPEED)) {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();