From acb439e3d9d9e3098181328a983e4d4a119e46e7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 21 Dec 2021 22:01:59 +0100 Subject: [PATCH 1/3] Limit block breaking to team area Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/listener/TeamArea.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java index 75a1fd8..383acf2 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java @@ -34,6 +34,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -77,6 +78,16 @@ public class TeamArea implements Listener { FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR); } + @EventHandler + public void blockBreak(BlockBreakEvent event) { + Block block = event.getBlock(); + if(Config.BlueExtendRegion.inRegion(block) || Config.RedExtendRegion.inRegion(block)) + return; + + event.setCancelled(true); + FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", event.getPlayer(), ChatMessageType.ACTION_BAR); + } + private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) { boolean spectator = player.getGameMode() == GameMode.SPECTATOR; if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player)) -- 2.39.2 From 27056e4842f5ff0f1a91eb007d57fa016635e154 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 22 Dec 2021 12:17:33 +0100 Subject: [PATCH 2/3] Limit block breaking below ground Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/listener/TeamArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java index 383acf2..5dfa2a4 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java @@ -81,7 +81,7 @@ public class TeamArea implements Listener { @EventHandler public void blockBreak(BlockBreakEvent event) { Block block = event.getBlock(); - if(Config.BlueExtendRegion.inRegion(block) || Config.RedExtendRegion.inRegion(block)) + if(Config.BluePasteRegion.getMinY() >= block.getY()) return; event.setCancelled(true); -- 2.39.2 From bb3114ba6165863caa17af76ad930b1a46bdd1ca Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 23 Dec 2021 12:09:27 +0100 Subject: [PATCH 3/3] Fix direction Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/listener/TeamArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java index 5dfa2a4..2dfaf34 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/TeamArea.java @@ -81,7 +81,7 @@ public class TeamArea implements Listener { @EventHandler public void blockBreak(BlockBreakEvent event) { Block block = event.getBlock(); - if(Config.BluePasteRegion.getMinY() >= block.getY()) + if(Config.BluePasteRegion.getMinY() <= block.getY()) return; event.setCancelled(true); -- 2.39.2