From a405611b3a64c0eb2e2ed37141848ac4f76cfbd4 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Tue, 3 Aug 2021 23:03:53 +0200 Subject: [PATCH] Fix emptying buckets in plot border (#3192) * Fix emptying buckets in plot border * Note on 1.13 compatibility for bucket-empty event Co-authored-by: NotMyFault --- .../plotsquared/bukkit/listener/PlayerEventListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 503a6c7f0..c8bc826bc 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -1167,10 +1167,15 @@ public class PlayerEventListener extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBucketEmpty(PlayerBucketEmptyEvent event) { BlockFace bf = event.getBlockFace(); + // Note: a month after Bukkit 1.14.4 released, they added the API method + // PlayerBucketEmptyEvent#getBlock(), which returns the block the + // bucket contents is going to be placed at. Currently we determine this + // block ourselves to retain compatibility with 1.13. final Block block; // if the block can be waterlogged, the event might waterlog the block // sometimes - if (event.getBlockClicked().getBlockData() instanceof Waterlogged) { + if (event.getBlockClicked().getBlockData() instanceof Waterlogged waterlogged + && !waterlogged.isWaterlogged() && event.getBucket() != Material.LAVA_BUCKET) { block = event.getBlockClicked(); } else { block = event.getBlockClicked().getLocation()