mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 00:50:41 +01:00
44 lines
2.5 KiB
Diff
44 lines
2.5 KiB
Diff
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
|
@@ -0,0 +0,0 @@ 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);
|
|
@@ -0,0 +0,0 @@ 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() {
|