Fix NPE for bucket empty result stack being null (#7354)

This commit is contained in:
Jake Potrebic 2022-01-16 12:08:24 -08:00
parent c8208e9482
commit 2fcdb1b8ed

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class BucketItem extends Item implements DispensibleContainerItem {
+ private static ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
+ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
+
public final Fluid content;
@ -36,9 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}
+ // Paper start
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack());
+ // Paper end
+ 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 (!flag1) {