From 584406a8f63d6df0097f56a0887ef87f5a9262ac Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Sat, 22 Sep 2012 13:12:42 +0500 Subject: [PATCH] Properly consider world water/lava logging config. Fixes #202 --- .../LogBlock/listeners/FluidFlowLogging.java | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/diddiz/LogBlock/listeners/FluidFlowLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/FluidFlowLogging.java index f706666..5df6411 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/FluidFlowLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/FluidFlowLogging.java @@ -30,36 +30,42 @@ public class FluidFlowLogging extends LoggingListener final int typeTo = to.getTypeId(); final boolean canFlow = typeTo == 0 || nonFluidProofBlocks.contains(typeTo); if (typeFrom == 10 || typeFrom == 11) { - if (canFlow) { + if (canFlow && wcfg.isLogging(Logging.LAVAFLOW)) { if (isSurroundedByWater(to) && event.getBlock().getData() <= 2) consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0); else if (typeTo == 0) { - if (wcfg.isLogging(Logging.LAVAFLOW)) - consumer.queueBlockPlace("LavaFlow", to.getLocation(), 10, (byte)(event.getBlock().getData() + 1)); - } else + consumer.queueBlockPlace("LavaFlow", to.getLocation(), 10, (byte)(event.getBlock().getData() + 1)); + } else { consumer.queueBlockReplace("LavaFlow", to.getState(), 10, (byte)(event.getBlock().getData() + 1)); - } else if (typeTo == 8 || typeTo == 9) - if (event.getFace() == BlockFace.DOWN) + } + } else if (typeTo == 8 || typeTo == 9) { + if (event.getFace() == BlockFace.DOWN) { consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0); - else + } else { consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0); - } else if (typeFrom == 8 || typeFrom == 9) { + } + } + } else if ((typeFrom == 8 || typeFrom == 9) && wcfg.isLogging(Logging.WATERFLOW)) { if (typeTo == 0) { - if (wcfg.isLogging(Logging.WATERFLOW)) - consumer.queueBlockPlace("WaterFlow", to.getLocation(), 8, (byte)(event.getBlock().getData() + 1)); - } else if (nonFluidProofBlocks.contains(typeTo)) + consumer.queueBlockPlace("WaterFlow", to.getLocation(), 8, (byte)(event.getBlock().getData() + 1)); + } else if (nonFluidProofBlocks.contains(typeTo)) { consumer.queueBlockReplace("WaterFlow", to.getState(), 8, (byte)(event.getBlock().getData() + 1)); - else if (typeTo == 10 || typeTo == 11) - if (to.getData() == 0) + } + else if (typeTo == 10 || typeTo == 11) { + if (to.getData() == 0) { consumer.queueBlockReplace("WaterFlow", to.getState(), 49, (byte)0); - else if (event.getFace() == BlockFace.DOWN) + } else if (event.getFace() == BlockFace.DOWN) { consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0); - if (typeTo == 0 || nonFluidProofBlocks.contains(typeTo)) + } + } + if (typeTo == 0 || nonFluidProofBlocks.contains(typeTo)) { for (final BlockFace face : new BlockFace[]{BlockFace.DOWN, BlockFace.NORTH, BlockFace.WEST, BlockFace.EAST, BlockFace.SOUTH}) { final Block lower = to.getRelative(face); - if (lower.getTypeId() == 10 || lower.getTypeId() == 11) + if (lower.getTypeId() == 10 || lower.getTypeId() == 11) { consumer.queueBlockReplace("WaterFlow", lower.getState(), lower.getData() == 0 ? 49 : 4, (byte)0); + } } + } } } }