diff --git a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java index dfb3e134d..10dc45fe3 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java @@ -22,6 +22,7 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; +import org.bukkit.event.Event; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerListener; @@ -66,7 +67,7 @@ public WorldEditPlayerListener(WorldEditPlugin plugin) { */ @Override public void onPlayerQuit(PlayerQuitEvent event) { - plugin.getWorldEdit().markExpire(wrapPlayer(event.getPlayer())); + plugin.getWorldEdit().markExpire(plugin.wrapPlayer(event.getPlayer())); } /** @@ -82,7 +83,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String[] split = event.getMessage().split(" "); - if (plugin.getWorldEdit().handleCommand(wrapPlayer(event.getPlayer()), split)) { + if (plugin.getWorldEdit().handleCommand(plugin.wrapPlayer(event.getPlayer()), split)) { event.setCancelled(true); } } @@ -96,7 +97,11 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { */ @Override public void onPlayerInteract(PlayerInteractEvent event) { - final LocalPlayer player = wrapPlayer(event.getPlayer()); + if (event.useItemInHand() == Event.Result.DENY) { + return; + } + + final LocalPlayer player = plugin.wrapPlayer(event.getPlayer()); final LocalWorld world = player.getWorld(); final WorldEdit we = plugin.getWorldEdit(); @@ -162,8 +167,4 @@ public void run() { break; } } - - private BukkitPlayer wrapPlayer(Player player) { - return new BukkitPlayer(plugin, plugin.getServerInterface(), player); - } }