aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0120-Properly-fix-item-duplication-bug.patch
blob: 95bf2bd4b542ccecbb12fb13eb6d3d5f58f2ad32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 0000000000000000000000000000000000000000 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/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 984dc7f7f7315b8a8cdb9744ef8454a330888ba7..f067b10e13f01e751fc4ebf088740c7d40afcb99 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2627,7 +2627,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
 
     @Override
     public boolean isImmobile() {
-        return super.isImmobile() || !this.getBukkitEntity().isOnline();
+        return super.isImmobile() || (this.connection != null && this.connection.isDisconnected()); // Paper - Fix duplication bugs
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 8520f0f2b4b4e758b2e2fae206b7fd818a6fa14f..73d40f768b6882062656cba30acc5f86f26d1a96 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -179,7 +179,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
     }
 
     public final boolean isDisconnected() {
-        return !this.player.joining && !this.connection.isConnected();
+        return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs
     }
     // CraftBukkit end