From dfca0c4ce8989e8aeb36769a45c6e157eb68eab6 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 5 Mar 2022 12:39:42 +0100 Subject: [PATCH] Prevent hanging destruction Signed-off-by: Lixfel --- .../fightsystem/listener/DenyWorldInteraction.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java index 8371567..f0e430d 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java @@ -33,6 +33,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.player.PlayerKickEvent; public class DenyWorldInteraction implements Listener { @@ -51,6 +52,13 @@ public class DenyWorldInteraction implements Listener { } } + @EventHandler + public void handleHangingBreak(HangingBreakEvent event) { + if(Config.ArenaRegion.inRegion(event.getEntity().getLocation())) { + event.setCancelled(true); + } + } + @EventHandler public void handleBlockPlace(BlockPlaceEvent event) { Player player = event.getPlayer();