From 8319e912f4ae9cefe4d731d7eaa1eaa901d0c8fb Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 17 Oct 2020 12:46:35 +0100 Subject: [PATCH] Fix SafeNBTCopy#hasKey semantics Fixes hasKey to check that a key actually exists, while retaining the option to scream at keys which are requested which haven't been marked as needing to be copied --- .../0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index 386c40b37..e823eb0aa 100644 --- a/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -16,7 +16,7 @@ We further improve it by making a copy of the nbt tag with only the memory it needs, so that we dont have to hold a copy to the entire compound. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index f18cb4aedc4a6536bf45db591b6d2b64cefce676..c27078630bffe1b2493b42c9ae4431fb1cc5ca09 100644 +index f18cb4aedc4a6536bf45db591b6d2b64cefce676..5eb14b330d3f175e22650f292aa6c040f24e9492 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -156,15 +156,9 @@ public class ChunkRegionLoader { @@ -38,7 +38,7 @@ index f18cb4aedc4a6536bf45db591b6d2b64cefce676..c27078630bffe1b2493b42c9ae4431fb } else { ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter -@@ -270,6 +264,48 @@ public class ChunkRegionLoader { +@@ -270,6 +264,50 @@ public class ChunkRegionLoader { return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading } } @@ -61,8 +61,10 @@ index f18cb4aedc4a6536bf45db591b6d2b64cefce676..c27078630bffe1b2493b42c9ae4431fb + + @Override + public boolean hasKey(String s) { -+ if (this.keys.contains(s)) { ++ if (super.hasKey(s)) { + return true; ++ } else if (keys.contains(s)) { ++ return false; + } + throw new IllegalStateException("Missing Key " + s + " in SafeNBTCopy"); + }