Ignore PlayerInteracts with off-hand item.

Fixes WORLDEDIT-3437
The API will need to be changed to accomodate off-hand tools etc
This commit is contained in:
wizjany 2016-05-15 03:29:58 -04:00
parent 7be1395ae2
commit 32fb5b302d
2 changed files with 11 additions and 1 deletions

View File

@ -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'
}

View File

@ -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();