From 6be26e80470ec7a66f5cce56b08c7c9ad18ce901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Mon, 24 Feb 2020 12:11:22 +0100 Subject: [PATCH] Also consider negative locations when cancelling liquid flow --- .../bukkit/listeners/PlayerEvents.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 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 1c76668f0..3063586ef 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 @@ -1434,9 +1434,27 @@ import java.util.regex.Pattern; event.setCancelled(true); } else if (event.getBlock().isLiquid()) { final org.bukkit.Location location = event.getBlock().getLocation(); - if (BukkitUtil.getPlot(location.clone().add(0, 0, 1)) != null || - BukkitUtil.getPlot(location.clone().add(1, 0, 0)) != null || - BukkitUtil.getPlot(location.clone().add(1, 0, 1)) != null) { + + /* + X = block location + A-H = potential plot locations + + Z + ^ + | A B C + o D X E + | F G H + v + <-----O-----> x + */ + if (BukkitUtil.getPlot(location.clone().add(-1, 0, 1) /* A */ ) != null || + BukkitUtil.getPlot(location.clone().add(1, 0, 0) /* B */ ) != null || + BukkitUtil.getPlot(location.clone().add(1, 0, 1) /* C */ ) != null || + BukkitUtil.getPlot(location.clone().add(-1, 0, 0) /* D */ ) != null || + BukkitUtil.getPlot(location.clone().add(1, 0, 0) /* E */ ) != null || + BukkitUtil.getPlot(location.clone().add(-1, 0, -1) /* F */ ) != null || + BukkitUtil.getPlot(location.clone().add(0, 0, -1) /* G */ ) != null || + BukkitUtil.getPlot(location.clone().add(1, 0, 1) /* H */ ) != null) { event.setCancelled(true); } }