Fixed NullPointerExceptions in item use hook.

This commit is contained in:
sk89q 2011-01-08 18:38:18 -08:00
parent 484fe22e9e
commit 79f55a02cb

View File

@ -960,7 +960,7 @@ public boolean onInventoryChange(Player player) {
@Override @Override
public boolean onItemUse(Player player, Block blockPlaced, public boolean onItemUse(Player player, Block blockPlaced,
Block blockClicked, Item item) { Block blockClicked, Item item) {
if (blacklist != null) { if (blacklist != null && item != null) {
int itemId = item.getItemId(); int itemId = item.getItemId();
if (!blacklist.onUse(itemId, player)) { if (!blacklist.onUse(itemId, player)) {
@ -968,7 +968,7 @@ public boolean onItemUse(Player player, Block blockPlaced,
} }
} }
if (useRegions) { if (useRegions && blockPlaced != null) {
Vector pt = new Vector(blockPlaced.getX(), Vector pt = new Vector(blockPlaced.getX(),
blockPlaced.getY(), blockPlaced.getZ()); blockPlaced.getY(), blockPlaced.getZ());
LocalPlayer localPlayer = new HMPlayer(player); LocalPlayer localPlayer = new HMPlayer(player);