Fix for player right-clicking in the air causing an NPE due to target block being null
This commit is contained in:
parent
5ab5ef6724
commit
2ca8e4b9af
@ -153,6 +153,9 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
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()))
|
if (!this.playerCanUseItemHere(event.getPlayer(), event.getBlockClicked(), event.getItem().getTypeId()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user