From 98afdd7df632e3c9d6ad9bf9d14f08be037088f3 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 8 Jan 2011 13:11:03 -0800 Subject: [PATCH] Changed Bukkit listeners to cancel the event. --- src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java | 4 +++- src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java index 74d28e779..84d8eaaa8 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java @@ -65,7 +65,9 @@ public class WorldEditBlockListener extends BlockListener { event.getBlock().getY(), event.getBlock().getZ()); LocalPlayer player = wrapPlayer(event.getPlayer()); - plugin.controller.handleBlockRightClick(player, pos); + if (plugin.controller.handleBlockRightClick(player, pos)) { + event.setCancelled(true); + } } private BukkitPlayer wrapPlayer(Player player) { diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java index 20aa00d9c..d5ecc9b46 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java @@ -57,8 +57,10 @@ public class WorldEditPlayerListener extends PlayerListener { * @param event Relevant event details */ public void onPlayerCommand(PlayerChatEvent event) { - plugin.controller.handleCommand(wrapPlayer(event.getPlayer()), - event.getMessage().split(" ")); + if (plugin.controller.handleCommand(wrapPlayer(event.getPlayer()), + event.getMessage().split(" "))) { + event.setCancelled(true); + } } private BukkitPlayer wrapPlayer(Player player) {