mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
d5f1ffc2e6
With the new chunk system it doesn't hurt too much to (temporarily) remove this until implemented in a safer manner
27 lines
1.3 KiB
Diff
27 lines
1.3 KiB
Diff
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 1254ab553e0d2c8e1a0fd93b602dd339da05dabb..42f4c3dee830f0aa65392319a3c505d044e4c17c 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -570,6 +570,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();
|