Changed Bukkit listeners to cancel the event.

This commit is contained in:
sk89q 2011-01-08 13:11:03 -08:00
parent a36ceecaab
commit 98afdd7df6
2 changed files with 7 additions and 3 deletions

View File

@ -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) {

View File

@ -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) {