From 1fd4a9043fb0038d2b2e546bb8ea9f2a64637ad1 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 26 May 2024 17:45:45 -0700 Subject: [PATCH] Protect pumpkins from being sheared (#2388) Requires Paper --- .../listeners/flags/protection/ShearingListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/ShearingListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/ShearingListener.java index e35c370ee..0118bac5f 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/ShearingListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/ShearingListener.java @@ -4,6 +4,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerShearEntityEvent; +import io.papermc.paper.event.block.PlayerShearBlockEvent; import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.lists.Flags; @@ -20,4 +21,10 @@ public class ShearingListener extends FlagListener { checkIsland(e, e.getPlayer(), e.getEntity().getLocation(), Flags.SHEARING); } + // Block shearing - paper only + @EventHandler(priority = EventPriority.LOW) + public void onShearBlock(final PlayerShearBlockEvent e) { + checkIsland(e, e.getPlayer(), e.getBlock().getLocation(), Flags.SHEARING); + } + }