From 869b883b2f004f0b677d19959ea1694bd74402f7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Jan 2024 16:36:24 +0100 Subject: [PATCH] Fix WaterRemover for Water based armor Signed-off-by: Lixfel --- .../fightsystem/listener/WaterRemover.java | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java index a7097fb..28fd444 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java @@ -71,23 +71,25 @@ public class WaterRemover implements Listener { event.setYield(0); //No drops (additionally to world config) FightTeam spawn = tnt.remove(event.getEntity().getEntityId()); - if(spawn != null && event.blockList().isEmpty() && Fight.getOpposite(spawn).getExtendRegion().inRegion(event.getLocation())) { - checkBlock(event.getLocation().getBlock()); + if(spawn != null && event.blockList().isEmpty() && !spawn.getExtendRegion().inRegion(event.getLocation())) { + Block b = event.getLocation().getBlock(); + checkBlock(b); + checkNeighbours(b); } - for(Block b : event.blockList()){ - //b cannot be water or air due to current explosion + event.blockList().forEach(this::checkNeighbours); + } - checkBlock(b.getRelative(BlockFace.UP)); - checkBlock(b.getRelative(BlockFace.EAST)); - checkBlock(b.getRelative(BlockFace.WEST)); - checkBlock(b.getRelative(BlockFace.NORTH)); - checkBlock(b.getRelative(BlockFace.SOUTH)); - } + private void checkNeighbours(Block b) { + checkBlock(b.getRelative(BlockFace.UP)); + checkBlock(b.getRelative(BlockFace.EAST)); + checkBlock(b.getRelative(BlockFace.WEST)); + checkBlock(b.getRelative(BlockFace.NORTH)); + checkBlock(b.getRelative(BlockFace.SOUTH)); } private void checkBlock(Block b) { - //do not remove outside teamareas + //do not remove outside teamareasevent.getLocation().getBlock() if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b)) return; @@ -98,10 +100,6 @@ public class WaterRemover implements Listener { if(b.getY() < MIN_Y) return; - checkBlock(b.getRelative(BlockFace.UP)); - checkBlock(b.getRelative(BlockFace.EAST)); - checkBlock(b.getRelative(BlockFace.WEST)); - checkBlock(b.getRelative(BlockFace.NORTH)); - checkBlock(b.getRelative(BlockFace.SOUTH)); + checkNeighbours(b); } } -- 2.39.5