From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Feb 2019 00:15:28 -0500
Subject: [PATCH] Fix sign edit memory leak

when a player edits a sign, a reference to their Entity is never cleand up.

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b1c505d3fdcc2fb3496f80bee85e4895b9069dcb..276773e17149f57038cd21485fd9d9061670ff2d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2850,7 +2850,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
 
             SignBlockEntity tileentitysign = (SignBlockEntity) tileentity;
 
-            if (!tileentitysign.isEditable() || tileentitysign.getPlayerWhoMayEdit() != this.player) {
+            if (!tileentitysign.isEditable() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUUID())) {
                 ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
                 this.send(tileentity.getUpdatePacket()); // CraftBukkit
                 return;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index e4eab82855649fec654c60b2e94ba7b71c2ac5a2..0b26d3ab2db66d6baaa95d1d5f6c756595d31495 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -30,6 +30,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
     private Player playerWhoMayEdit;
     private final FormattedCharSequence[] renderMessages;
     private DyeColor color;
+    public java.util.UUID signEditor; // Paper
 
     public SignBlockEntity() {
         super(BlockEntityType.SIGN);
@@ -131,7 +132,10 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
     }
 
     public void setAllowedPlayerEditor(Player player) {
-        this.playerWhoMayEdit = player;
+        // Paper start
+        //this.c = entityhuman;
+        signEditor = player != null ? player.getUUID() : null;
+        // Paper end
     }
 
     public Player getPlayerWhoMayEdit() {