From c19d3fd0689b3a65b52e2f7dc9e290ed6dd76f49 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Fri, 28 Jun 2013 14:06:54 +0200 Subject: [PATCH] Fixed bug with Ice Fishing which allowed players to break protected blocks Fixes #2074 --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/PlayerListener.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index c0f42d934..a51b31a67 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -53,6 +53,7 @@ Version 1.4.06-dev = Fixed bug where the chance of a successful Gracefull Roll was twice as high as displayed = Fixed bug where lucky perks where not working = Fixed bug with Ice Fishing on a single block of ice + = Fixed bug with Ice Fishing which allowed players to break ice in protected areas = Fixed a small bug with mob healthbars and bosses, such as EnderDragons and Withers ! Changed Spout notification tiers to be stored in SpoutConfig instead of AdvancedConfig ! Changed Berserk to add items to inventory rather than denying pickup diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index fe8cacd9f..773969856 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; @@ -192,6 +193,13 @@ public class PlayerListener implements Listener { Block block = event.getPlayer().getTargetBlock(null, 100); if (fishingManager.canIceFish(block)) { + BlockBreakEvent blockBreakEvent = new BlockBreakEvent(block, player); + mcMMO.p.getServer().getPluginManager().callEvent(blockBreakEvent); + + if (blockBreakEvent.isCancelled()) { + return; + } + event.setCancelled(true); fishingManager.iceFishing(hook, block); }