Paper/patches/unapplied/server/0539-Drop-carried-item-when-player-has-disconnected.patch

28 Zeilen
1.4 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmitry Sidorov <jonmagon@gmail.com>
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 6a00304ea9eac600162eae03e70aa28f39149c5f..563e287cfb885f212ebe9dfc8309aa123713897a 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -596,6 +596,14 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
}
// Paper end - Configurable player collision
2021-06-11 14:02:28 +02:00
+ // Paper - Drop carried item when player has disconnected
2021-06-15 04:59:31 +02:00
+ if (!entityplayer.containerMenu.getCarried().isEmpty()) {
+ net.minecraft.world.item.ItemStack carried = entityplayer.containerMenu.getCarried();
+ entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY);
2021-06-11 14:02:28 +02:00
+ entityplayer.drop(carried, false);
+ }
+ // Paper end - Drop carried item when player has disconnected
2021-06-11 14:02:28 +02:00
+
this.save(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();