From aa8d2bfcd027dc52e77c764cbc7ad0305aa47870 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 15 Mar 2024 16:27:43 +0100 Subject: [PATCH] Fix BucketEntityEvent on 1.15 (and 1.19 Build servers) --- .../features/world/SpectatorListener.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java index 5563f7a6..6829fe5b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java @@ -25,6 +25,7 @@ import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.utils.BauMemberUpdateEvent; import de.steamwar.inventory.SWItem; import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import de.steamwar.sql.BauweltMember; import de.steamwar.techhider.TechHider; import org.bukkit.Bukkit; @@ -223,13 +224,6 @@ public class SpectatorListener implements Listener { } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onPlayerBucketEntity(PlayerBucketEntityEvent event) { - if (!Permission.BUILD.hasPermission(event.getPlayer())) { - event.setCancelled(true); - } - } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerBucketFill(PlayerBucketFillEvent event) { if (!Permission.BUILD.hasPermission(event.getPlayer())) { @@ -251,4 +245,15 @@ public class SpectatorListener implements Listener { event.setCancelled(true); } } + + @Linked + @MinVersion(20) + public static class SpectatorListener20 implements Listener { + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onPlayerBucketEntity(PlayerBucketEntityEvent event) { + if (!Permission.BUILD.hasPermission(event.getPlayer())) { + event.setCancelled(true); + } + } + } } -- 2.39.2