aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch')
-rw-r--r--patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch
new file mode 100644
index 0000000000..7811bd17da
--- /dev/null
+++ b/patches/server/0567-Drop-carried-item-when-player-has-disconnected.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dmitry Sidorov <[email protected]>
+Date: Thu, 4 Feb 2021 20:32:01 +0300
+Subject: [PATCH] Drop carried item when player has disconnected
+
+Fixes disappearance of held items, when a player gets disconnected and PlayerDropItemEvent is cancelled.
+Closes #5036
+
+diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
+index 8662ded9a7d7bf75dcec2c859f9e76d3d63a8b29..690bb831c41a344b284c16f2c44954f652784bdb 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -578,6 +578,14 @@ public abstract class PlayerList {
+ }
+ // Paper end
+
++ // Paper - Drop carried item when player has disconnected
++ if (!entityplayer.containerMenu.getCarried().isEmpty()) {
++ net.minecraft.world.item.ItemStack carried = entityplayer.containerMenu.getCarried();
++ entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY);
++ entityplayer.drop(carried, false);
++ }
++ // Paper end
++
+ this.save(entityplayer);
+ if (entityplayer.isPassenger()) {
+ Entity entity = entityplayer.getRootVehicle();