SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Fix WaterRemover for Water based armor' (#409) from waterremover into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #409
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2024-01-05 16:42:52 +01:00
Commit ed1ab06ce1

Datei anzeigen

@ -71,23 +71,25 @@ public class WaterRemover implements Listener {
event.setYield(0); //No drops (additionally to world config) event.setYield(0); //No drops (additionally to world config)
FightTeam spawn = tnt.remove(event.getEntity().getEntityId()); FightTeam spawn = tnt.remove(event.getEntity().getEntityId());
if(spawn != null && event.blockList().isEmpty() && Fight.getOpposite(spawn).getExtendRegion().inRegion(event.getLocation())) { if(spawn != null && event.blockList().isEmpty() && !spawn.getExtendRegion().inRegion(event.getLocation())) {
checkBlock(event.getLocation().getBlock()); Block b = event.getLocation().getBlock();
checkBlock(b);
checkNeighbours(b);
} }
for(Block b : event.blockList()){ event.blockList().forEach(this::checkNeighbours);
//b cannot be water or air due to current explosion }
checkBlock(b.getRelative(BlockFace.UP)); private void checkNeighbours(Block b) {
checkBlock(b.getRelative(BlockFace.EAST)); checkBlock(b.getRelative(BlockFace.UP));
checkBlock(b.getRelative(BlockFace.WEST)); checkBlock(b.getRelative(BlockFace.EAST));
checkBlock(b.getRelative(BlockFace.NORTH)); checkBlock(b.getRelative(BlockFace.WEST));
checkBlock(b.getRelative(BlockFace.SOUTH)); checkBlock(b.getRelative(BlockFace.NORTH));
} checkBlock(b.getRelative(BlockFace.SOUTH));
} }
private void checkBlock(Block b) { 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)) if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b))
return; return;
@ -98,10 +100,6 @@ public class WaterRemover implements Listener {
if(b.getY() < MIN_Y) if(b.getY() < MIN_Y)
return; return;
checkBlock(b.getRelative(BlockFace.UP)); checkNeighbours(b);
checkBlock(b.getRelative(BlockFace.EAST));
checkBlock(b.getRelative(BlockFace.WEST));
checkBlock(b.getRelative(BlockFace.NORTH));
checkBlock(b.getRelative(BlockFace.SOUTH));
} }
} }