From 32fb5b302dae7580e7a9ac95b86ac00b7bee65df Mon Sep 17 00:00:00 2001 From: wizjany Date: Sun, 15 May 2016 03:29:58 -0400 Subject: [PATCH] Ignore PlayerInteracts with off-hand item. Fixes WORLDEDIT-3437 The API will need to be changed to accomodate off-hand tools etc --- worldedit-bukkit/build.gradle | 2 +- .../com/sk89q/worldedit/bukkit/WorldEditListener.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index cc23519df..2413532e3 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -8,7 +8,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' - compile 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT' // zzz + compile 'org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT' // zzz testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java index 70455cbcb..af5736b93 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java @@ -37,6 +37,7 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.EquipmentSlot; /** * Handles all events thrown in relation to a Player @@ -116,6 +117,15 @@ public class WorldEditListener implements Listener { return; } + try { + if (event.getHand() == EquipmentSlot.OFF_HAND) { + return; // TODO api needs to be able to get either hand depending on event + // for now just ignore all off hand interacts + } + } catch (NoSuchMethodError ignored) { + } catch (NoSuchFieldError ignored) { + } + final LocalPlayer player = plugin.wrapPlayer(event.getPlayer()); final World world = player.getWorld(); final WorldEdit we = plugin.getWorldEdit();