diff options
Diffstat (limited to 'patches/server/0611-Fix-PlayerBucketEmptyEvent-result-itemstack.patch')
-rw-r--r-- | patches/server/0611-Fix-PlayerBucketEmptyEvent-result-itemstack.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0611-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0611-Fix-PlayerBucketEmptyEvent-result-itemstack.patch new file mode 100644 index 0000000000..1dbdf33922 --- /dev/null +++ b/patches/server/0611-Fix-PlayerBucketEmptyEvent-result-itemstack.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Thu, 20 May 2021 22:16:37 -0700 +Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack + +Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560 + +diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java +index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..277555a26e8281dd1a626e572794b08cf51d00c5 100644 +--- a/src/main/java/net/minecraft/world/item/BucketItem.java ++++ b/src/main/java/net/minecraft/world/item/BucketItem.java +@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent; + + public class BucketItem extends Item implements DispensibleContainerItem { + ++ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper ++ + public final Fluid content; + + public BucketItem(Fluid fluid, Item.Properties settings) { +@@ -122,6 +124,13 @@ public class BucketItem extends Item implements DispensibleContainerItem { + } + + public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) { ++ // Paper start ++ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) { ++ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent; ++ itemLeftInHandAfterPlayerBucketEmptyEvent = null; ++ return itemInHand; ++ } ++ // Paper end + return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack; + } + +@@ -181,6 +190,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { + ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 + return false; + } ++ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - fix empty event result itemstack + } + // CraftBukkit end + if (!flag2) { |