diff options
Diffstat (limited to 'patches/api/0228-Add-PlayerShearBlockEvent.patch')
-rw-r--r-- | patches/api/0228-Add-PlayerShearBlockEvent.patch | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/patches/api/0228-Add-PlayerShearBlockEvent.patch b/patches/api/0228-Add-PlayerShearBlockEvent.patch index 051544b4a9..1506924937 100644 --- a/patches/api/0228-Add-PlayerShearBlockEvent.patch +++ b/patches/api/0228-Add-PlayerShearBlockEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerShearBlockEvent diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f42838758bfd +index 0000000000000000000000000000000000000000..9bb4a79320eac7d662d9d04765664b6a7e955a4f --- /dev/null +++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java -@@ -0,0 +1,108 @@ +@@ -0,0 +1,113 @@ +package io.papermc.paper.event.block; + +import org.bukkit.block.Block; @@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +import java.util.List; @@ -32,15 +33,19 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb. + */ +public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable { -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled = false; ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ + private final Block block; + private final ItemStack item; + private final EquipmentSlot hand; + private final List<ItemStack> drops; + -+ public PlayerShearBlockEvent(@NotNull Player who, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops) { -+ super(who); ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerShearBlockEvent(@NotNull Player player, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops) { ++ super(player); + this.block = block; + this.item = item; + this.hand = hand; @@ -54,7 +59,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + */ + @NotNull + public Block getBlock() { -+ return block; ++ return this.block; + } + + /** @@ -64,7 +69,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + */ + @NotNull + public ItemStack getItem() { -+ return item; ++ return this.item; + } + + /** @@ -74,7 +79,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + */ + @NotNull + public EquipmentSlot getHand() { -+ return hand; ++ return this.hand; + } + + /** @@ -84,7 +89,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + */ + @NotNull + public List<ItemStack> getDrops() { -+ return drops; ++ return this.drops; + } + + /** @@ -94,7 +99,7 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + */ + @Override + public boolean isCancelled() { -+ return cancelled; ++ return this.cancelled; + } + + /** @@ -110,11 +115,11 @@ index 0000000000000000000000000000000000000000..aa7d440b797eac9e62678d03cc87f428 + @NotNull + @Override + public HandlerList getHandlers() { -+ return handlers; ++ return HANDLER_LIST; + } + + @NotNull + public static HandlerList getHandlerList() { -+ return handlers; ++ return HANDLER_LIST; + } +} |