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
|
2021-06-17 10:37:27 +02:00
|
|
|
index 458188eb409a945fdaea68eb9681ba7625dd39cd..22529dec70914a8b2ffdb8a4677eca23ac754249 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
|
2021-06-17 10:37:27 +02:00
|
|
|
@@ -606,6 +606,14 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
+ // 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
|
|
|
|
+
|
|
|
|
this.save(entityplayer);
|
|
|
|
if (entityplayer.isPassenger()) {
|
|
|
|
Entity entity = entityplayer.getRootVehicle();
|