From 87056a2d965710e5fda9fcb9c1e80eddeee17f47 Mon Sep 17 00:00:00 2001 From: Dor Date: Sat, 5 Mar 2016 23:38:09 +0200 Subject: [PATCH] Require sneaking to activate abilities if the player is holding an item on the offhand. --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index ca15c9f42..c0f37ed0a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -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,7 +573,10 @@ 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()) { mcMMOPlayer.processAbilityActivation(SkillType.AXES);