Fix for player right-clicking in the air causing an NPE due to target block being null

This commit is contained in:
Brettflan 2011-03-09 18:21:17 -06:00
parent 5ab5ef6724
commit 2ca8e4b9af
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ public class FactionsPlayerListener extends PlayerListener{
if (event.isCancelled())
return;
if (event.getBlockClicked() == null)
return; // right-clicked on air, not a block; no worries then
if (!this.playerCanUseItemHere(event.getPlayer(), event.getBlockClicked(), event.getItem().getTypeId()))
{
event.setCancelled(true);