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()) { switch (event.getAction()) {
case RIGHT_CLICK_BLOCK: case RIGHT_CLICK_BLOCK:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isSneaking()) {
return false;
}
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
BlockState blockState = block.getState(); BlockState blockState = block.getState();
@ -569,7 +573,10 @@ public class PlayerListener implements Listener {
break; break;
case RIGHT_CLICK_AIR: case RIGHT_CLICK_AIR:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isSneaking()) {
return false;
}
/* ACTIVATION CHECKS */ /* ACTIVATION CHECKS */
if (Config.getInstance().getAbilitiesEnabled()) { if (Config.getInstance().getAbilitiesEnabled()) {
mcMMOPlayer.processAbilityActivation(SkillType.AXES); mcMMOPlayer.processAbilityActivation(SkillType.AXES);