Canceling the useage event
This commit is contained in:
parent
2437e206b7
commit
62d37c061a
Binary file not shown.
@ -884,14 +884,18 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
if (block == null) return; // clicked in air, apparently
|
if (block == null) return; // clicked in air, apparently
|
||||||
|
|
||||||
SavageFactions.plugin.log("Checking if I can use the block");
|
SavageFactions.plugin.log("Checking if I can use the block");
|
||||||
if (canPlayerUseBlock(player, block, false)) return;
|
if (!canPlayerUseBlock(player, block, false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setUseInteractedBlock(Event.Result.DENY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SavageFactions.plugin.log("Checking if I can use the item");
|
SavageFactions.plugin.log("Checking if I can use the item");
|
||||||
if (playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) return;
|
if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
SavageFactions.plugin.log("Guess we will cancel the event then");
|
event.setUseInteractedBlock(Event.Result.DENY);
|
||||||
event.setCancelled(true);
|
return;
|
||||||
event.setUseInteractedBlock(Event.Result.DENY);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user