aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch
diff options
context:
space:
mode:
authorNewwind <[email protected]>2024-08-31 19:29:50 +0100
committerGitHub <[email protected]>2024-08-31 20:29:50 +0200
commit509ea2fd17fa03ce04f86046098607733b8767ba (patch)
tree3f7c9a29481fafbb6ad9f846839ec8f4863d2363 /patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch
parente01ddf46279fbb68d157749a906b7a2ecc60da1a (diff)
downloadPaper-509ea2fd17fa03ce04f86046098607733b8767ba.tar.gz
Paper-509ea2fd17fa03ce04f86046098607733b8767ba.zip
Fix horse armor desync (#11341)
Diffstat (limited to 'patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch')
-rw-r--r--patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0504-Drop-carried-item-when-player-has-disconnected.patch
new file mode 100644
index 0000000000..e7dd2e05b7
--- /dev/null
+++ b/patches/server/0504-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 3ed10df63671725b823247840bb057292f747f3f..28d99ca33606d2ff44c639c78edfcaa131faf626 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -588,6 +588,14 @@ public abstract class PlayerList {
+ }
+ // Paper end - Configurable player collision
+
++ // 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 - Drop carried item when player has disconnected
++
+ this.save(entityplayer);
+ if (entityplayer.isPassenger()) {
+ Entity entity = entityplayer.getRootVehicle();