From 616d22ceac7556e02036b97f840f3a949a791a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Wed, 8 Apr 2020 17:01:41 +0200 Subject: [PATCH] Fix liquid-flow --- .../bukkit/listeners/PlayerEvents.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 291c574ed..a4c5f8ce5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1439,6 +1439,18 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onChange(BlockFromToEvent event) { Block from = event.getBlock(); + + // Check liquid flow flag inside of origin plot too + final Location fLocation = BukkitUtil.getLocation(from.getLocation()); + final PlotArea fromArea = fLocation.getPlotArea(); + if (fromArea != null) { + final Plot plot = fromArea.getOwnedPlot(fLocation); + if (plot != null && !plot.getFlag(LiquidFlowFlag.class) && event.getBlock().isLiquid()) { + event.setCancelled(true); + return; + } + } + Block to = event.getToBlock(); Location tLocation = BukkitUtil.getLocation(to.getLocation()); PlotArea area = tLocation.getPlotArea(); @@ -1446,7 +1458,6 @@ public class PlayerEvents extends PlotListener implements Listener { return; } Plot plot = area.getOwnedPlot(tLocation); - Location fLocation = BukkitUtil.getLocation(from.getLocation()); if (plot != null) { if (plot.getFlag(DisablePhysicsFlag.class)) { event.setCancelled(true); @@ -1456,12 +1467,8 @@ public class PlayerEvents extends PlotListener implements Listener { event.setCancelled(true); return; } - if (!plot.getFlag(LiquidFlowFlag.class)) { - switch (to.getType()) { - case WATER: - case LAVA: - event.setCancelled(true); - } + if (!plot.getFlag(LiquidFlowFlag.class) && event.getBlock().isLiquid()) { + event.setCancelled(true); } } else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects .equals(null, area.getOwnedPlot(fLocation))) {