aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch')
-rw-r--r--patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch
new file mode 100644
index 0000000000..e1945e2b80
--- /dev/null
+++ b/patches/server/0338-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Lukasz Derlatka <[email protected]>
+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 9d3a88ed093c5eda7a11133ebc97226c544fbd18..0df93b204ddf55a2a3b8af33d6a3273697eea91e 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -1870,6 +1870,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ 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()) {