From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Lukasz Derlatka Date: Mon, 11 Nov 2019 16:08:13 +0100 Subject: [PATCH] Fix AssertionError when player hand set to empty type Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent Fixes GH-2718 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 6c773657094f31d52ed5e5f13726d847786d4d7b..1f90edd5eba696303962523439133d19514ebc32 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1790,6 +1790,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } + // Paper start + itemstack = this.player.getItemInHand(enumhand); + if (itemstack.isEmpty()) return; + // Paper end InteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand); if (enuminteractionresult.shouldSwing()) {