From b1fcecc9782a86c510957e4df7f27fda452187dc Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Tue, 27 Dec 2016 01:57:57 +0000
Subject: [PATCH] Properly fix item duplication bug

Credit to prplz for figuring out the real issue

diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 46d1dddca..c3026530d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1791,7 +1791,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
 
     @Override
     protected boolean isFrozen() {
-        return super.isFrozen() || !getBukkitEntity().isOnline();
+        return super.isFrozen() || (this.playerConnection != null && this.playerConnection.isDisconnected()); // Paper
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3788cc37e..a7e082246 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2540,7 +2540,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
     }
 
     public final boolean isDisconnected() {
-        return !this.player.joining && !this.networkManager.isConnected();
+        return (!this.player.joining && !this.networkManager.isConnected()) || this.processedDisconnect; // Paper
     }
     // CraftBukkit end
 
-- 
2.21.0