Require sneaking to activate abilities if the player is holding an item on the offhand.

This commit is contained in:
Dor 2016-03-05 23:38:09 +02:00
parent 28a2b9668d
commit 87056a2d96

View File

@ -528,6 +528,10 @@ public class PlayerListener implements Listener {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isSneaking()) {
return false;
}
Block block = event.getClickedBlock();
BlockState blockState = block.getState();
@ -569,6 +573,9 @@ public class PlayerListener implements Listener {
break;
case RIGHT_CLICK_AIR:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isSneaking()) {
return false;
}
/* ACTIVATION CHECKS */
if (Config.getInstance().getAbilitiesEnabled()) {