瀏覽代碼

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

Fixes #2074
TfT_02 12 年之前
父節點
當前提交
c19d3fd068
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 1 0
      Changelog.txt
  2. 8 0
      src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

+ 1 - 0
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

+ 8 - 0
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);
                 }