From 896c7fc4670f46d818e8280b7967e1059cfb196e Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 2 Apr 2011 13:48:40 -0700 Subject: [PATCH] Improved the cake processing mix to be less bitter. --- .../bukkit/WorldGuardBlockListener.java | 28 ------------------- .../bukkit/WorldGuardPlayerListener.java | 10 ++----- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java b/src/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java index 4d462277..0a8ad150 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java @@ -57,14 +57,11 @@ public void registerEvents() { PluginManager pm = plugin.getServer().getPluginManager(); - pm.registerEvent(Event.Type.BLOCK_DAMAGE, this, Priority.High, plugin); pm.registerEvent(Event.Type.BLOCK_BREAK, this, Priority.High, plugin); pm.registerEvent(Event.Type.BLOCK_FROMTO, this, Priority.Normal, plugin); pm.registerEvent(Event.Type.BLOCK_IGNITE, this, Priority.High, plugin); pm.registerEvent(Event.Type.BLOCK_PHYSICS, this, Priority.Normal, plugin); - //pm.registerEvent(Event.Type.BLOCK_INTERACT, this, Priority.High, plugin); pm.registerEvent(Event.Type.BLOCK_PLACE, this, Priority.High, plugin); - //pm.registerEvent(Event.Type.BLOCK_RIGHTCLICK, this, Priority.High, plugin); pm.registerEvent(Event.Type.BLOCK_BURN, this, Priority.High, plugin); pm.registerEvent(Event.Type.REDSTONE_CHANGE, this, Priority.High, plugin); } @@ -77,31 +74,6 @@ protected WorldConfiguration getWorldConfig(Player player) { return plugin.getGlobalConfiguration().get(player.getWorld()); } - /** - * Called when a block is damaged. - */ - @Override - public void onBlockDamage(BlockDamageEvent event) { - if (event.isCancelled()) { - return; - } - - Player player = event.getPlayer(); - Block blockDamaged = event.getBlock(); - - // Cake are damaged and not broken when they are eaten, so we must - // handle them a bit separately - if (blockDamaged.getType() == Material.CAKE_BLOCK) { - if (!plugin.getGlobalRegionManager().canBuild(player, blockDamaged)) { - player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!"); - event.setCancelled(true); - return; - } - } - - - } - /** * Called when a block is broken. */ diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java b/src/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java index be595ad3..987ef3be 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardPlayerListener.java @@ -198,13 +198,9 @@ public void handleBlockRightClick(PlayerInteractEvent event) { if (wcfg.useRegions && type == Material.CAKE_BLOCK) { if (!set.canBuild(localPlayer)) { - player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area."); - - byte newData = (byte) (block.getData() - 1); - newData = newData < 0 ? 0 : newData; - block.setData(newData); - player.setHealth(player.getHealth() - 3); - + player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!"); + + event.setCancelled(true); return; } }