Fixed bug with Ice Fishing which allowed players to break protected blocks

Fixes #2074
This commit is contained in:
TfT_02 2013-06-28 14:06:54 +02:00
parent 0f8312dd5e
commit c19d3fd068
2 changed files with 9 additions and 0 deletions

View File

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

View File

@ -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);
}