From 89318be5f497ed977969579e3ab5048882270a36 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 29 Sep 2020 15:53:23 +0100 Subject: [PATCH 1/4] Apply e2f9b4245b9f7168fc38d9cb10cd05efcb42fe05 to paper listener too --- .../plotsquared/bukkit/listener/PaperListener.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index e3995d9df..9b676c7b4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -221,19 +221,22 @@ public class PaperListener implements Listener { } Plot plot = location.getOwnedPlotAbs(); if (plot == null) { + EntityType type = event.getType(); if (!area.isMobSpawning()) { - EntityType type = event.getType(); switch (type) { case DROPPED_ITEM: if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { - event.setShouldAbortSpawn(true); event.setCancelled(true); - break; + return; } case PLAYER: return; } - event.setShouldAbortSpawn(true); + if (type.isAlive()) { + event.setCancelled(true); + } + } + if (!area.isMiscSpawnUnowned() && !type.isAlive()) { event.setCancelled(true); } return; From 2f5ce6715430c08d43434767ac53214a66819bb6 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 29 Sep 2020 15:55:08 +0100 Subject: [PATCH 2/4] add back setShouldAbortSpawn --- .../java/com/plotsquared/bukkit/listener/PaperListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index 9b676c7b4..0413802e7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -226,6 +226,7 @@ public class PaperListener implements Listener { switch (type) { case DROPPED_ITEM: if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { + event.setShouldAbortSpawn(true); event.setCancelled(true); return; } @@ -233,10 +234,12 @@ public class PaperListener implements Listener { return; } if (type.isAlive()) { + event.setShouldAbortSpawn(true); event.setCancelled(true); } } if (!area.isMiscSpawnUnowned() && !type.isAlive()) { + event.setShouldAbortSpawn(true); event.setCancelled(true); } return; From 95f509d33781ede09a266babb7e764bff93d0498 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 2 Oct 2020 15:08:14 +0100 Subject: [PATCH 3/4] Stop forcing loiwercase world names --- .../main/java/com/plotsquared/core/setup/CommonSetupSteps.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java index 0a8c7ba9a..f2ff58dd2 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java @@ -282,7 +282,7 @@ public enum CommonSetupSteps implements SetupStep { private static boolean isValidWorldName(String s) { return s.chars().allMatch((i) -> { - return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; + return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46; }); } } From 81d0bf6f047e2c774c4b3c7a3b8c2263d466fb7f Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 3 Oct 2020 21:53:58 +0200 Subject: [PATCH 4/4] Prevent blocks from getting waterlogged In some cases, the PlayerInteractEvent doesn't cancel right clicks on blocks that can be waterlogged --- .../bukkit/listener/PlayerEventListener.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 8392591b5..c5bcfd8c9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -82,6 +82,7 @@ import org.bukkit.FluidCollisionMode; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Waterlogged; import org.bukkit.command.PluginCommand; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; @@ -1070,9 +1071,16 @@ public class PlayerEventListener extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBucketEmpty(PlayerBucketEmptyEvent event) { BlockFace bf = event.getBlockFace(); - Block block = - event.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()) - .getBlock(); + final Block block; + // if the block can be waterlogged, the event might waterlog the block + // sometimes + if (event.getBlockClicked().getBlockData() instanceof Waterlogged) { + block = event.getBlockClicked(); + } else { + block = event.getBlockClicked().getLocation() + .add(bf.getModX(), bf.getModY(), bf.getModZ()) + .getBlock(); + } Location location = BukkitUtil.getLocation(block.getLocation()); PlotArea area = location.getPlotArea(); if (area == null) {