From 7c11dbee6d7b80e87d45dc4381d5386db50eab9d Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 9 Sep 2018 15:29:22 -0400 Subject: [PATCH] Forgot to rebuild patches after I fixed things in upstream update --- .../0062-Chunk-save-queue-improvements.patch | 40 ++++++++++++++----- .../0125-Fix-Double-World-Add-issues.patch | 6 +-- ...vent-Auto-Save-if-Save-Queue-is-full.patch | 6 +-- .../0145-Chunk-Save-Stats-Debug-Option.patch | 14 +++---- .../0302-Don-t-save-Proto-Chunks.patch | 6 +-- ...revent-Saving-Bad-entities-to-chunks.patch | 8 ++-- ...o-use-a-versioned-world-folder-for-t.patch | 12 +++--- Spigot-Server-Patches/0346-Anti-Xray.patch | 8 ++-- 8 files changed, 61 insertions(+), 39 deletions(-) diff --git a/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch b/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch index b25bc57300..b82feaf0ab 100644 --- a/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch +++ b/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch @@ -1,4 +1,4 @@ -From 47272a40d066580e0b7d14486215f020684e8bad Mon Sep 17 00:00:00 2001 +From c7b9d824fc6f8304e7d1e82fccaf1b0fc2a0233d Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 4 Mar 2016 18:18:37 -0600 Subject: [PATCH] Chunk save queue improvements @@ -41,7 +41,7 @@ index 0d68ffd75a..fd00c320ce 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 2e9bd0949a..3166d4b1ad 100644 +index 2e9bd0949a..1dbcedbf94 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -22,6 +22,7 @@ import java.util.function.Consumer; @@ -52,7 +52,7 @@ index 2e9bd0949a..3166d4b1ad 100644 import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Spigot start -@@ -31,6 +32,19 @@ import org.spigotmc.SupplierUtils; +@@ -31,6 +32,26 @@ import org.spigotmc.SupplierUtils; public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -60,6 +60,13 @@ index 2e9bd0949a..3166d4b1ad 100644 + private static class QueuedChunk { + public ChunkCoordIntPair coords; + public Supplier compoundSupplier; ++ public Runnable onSave; ++ ++ public QueuedChunk(Runnable run) { ++ this.coords = null; ++ this.compoundSupplier = null; ++ this.onSave = run; ++ } + + public QueuedChunk(ChunkCoordIntPair coords, Supplier compoundSupplier) { + this.coords = coords; @@ -72,7 +79,7 @@ index 2e9bd0949a..3166d4b1ad 100644 private static final Logger a = LogManager.getLogger(); private final Map> b = java.util.Collections.synchronizedMap(Maps.newHashMap()); // CraftBukkit // Spigot private final File c; -@@ -305,8 +319,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -305,8 +326,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } }; } @@ -83,19 +90,19 @@ index 2e9bd0949a..3166d4b1ad 100644 // Spigot end } catch (Exception exception) { ChunkRegionLoader.a.error("Failed to save chunk", exception); -@@ -315,7 +329,10 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -315,7 +336,10 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } protected void a(ChunkCoordIntPair chunkcoordintpair, Supplier nbttagcompound) { // Spigot - this.b.put(chunkcoordintpair, nbttagcompound); -+ synchronized (this.queue) { // Paper - synchronize while modifying the map ++ synchronized (this.b) { // Paper - synchronize while modifying the map + queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements + this.b.put(chunkcoordintpair, nbttagcompound); + } FileIOThread.a().a(this); } -@@ -325,20 +342,18 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -325,20 +349,24 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } private boolean processSaveQueueEntry(boolean logCompletion) { @@ -117,17 +124,23 @@ index 2e9bd0949a..3166d4b1ad 100644 - iterator.remove(); - ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) entry.getKey(); - Supplier nbttagcompound = (Supplier) entry.getValue(); // Spigot ++ // Paper start ++ if (chunk.onSave != null) { ++ chunk.onSave.run(); ++ return true; ++ } ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = chunk.coords; // Paper - Chunk queue improvements + Supplier nbttagcompound = chunk.compoundSupplier; // Spigot // Paper if (nbttagcompound == null) { return true; -@@ -347,6 +362,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -347,6 +375,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { // CraftBukkit start RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, SupplierUtils.getIfExists(nbttagcompound)); // Spigot + // Paper start remove from map only if this was the latest version of the chunk -+ synchronized (this.queue) { ++ synchronized (this.b) { + // This will not equal if a newer version is still pending - wait until newest is saved to remove + if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { + this.b.remove(chunkcoordintpair); @@ -137,6 +150,15 @@ index 2e9bd0949a..3166d4b1ad 100644 /* NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); dataoutputstream.close(); +@@ -362,7 +398,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + return true; + } + } +- } // CraftBukkit ++ // } // CraftBukkit // Paper + } + + private ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java index a3aba244af..97917551a4 100644 --- a/src/main/java/net/minecraft/server/FileIOThread.java diff --git a/Spigot-Server-Patches/0125-Fix-Double-World-Add-issues.patch b/Spigot-Server-Patches/0125-Fix-Double-World-Add-issues.patch index 8ebc4f7852..ccf69df407 100644 --- a/Spigot-Server-Patches/0125-Fix-Double-World-Add-issues.patch +++ b/Spigot-Server-Patches/0125-Fix-Double-World-Add-issues.patch @@ -1,4 +1,4 @@ -From be4d1a2e8b0408ab2496995a4b67bd819360bbd6 Mon Sep 17 00:00:00 2001 +From 9f6e2aa26857b197da5b8790ace6a8ffbe49c21e Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 21 Jun 2016 22:54:34 -0400 Subject: [PATCH] Fix Double World Add issues @@ -8,10 +8,10 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added. Also add debug if something else tries to, and abort before world gets bad state diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 3166d4b1ad..1c5b7903cc 100644 +index 1dbcedbf94..8e14f8c56c 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -1037,7 +1037,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -1050,7 +1050,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } public static void a(Entity entity, GeneratorAccess generatoraccess, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { diff --git a/Spigot-Server-Patches/0144-Prevent-Auto-Save-if-Save-Queue-is-full.patch b/Spigot-Server-Patches/0144-Prevent-Auto-Save-if-Save-Queue-is-full.patch index 8496e05504..540aaec652 100644 --- a/Spigot-Server-Patches/0144-Prevent-Auto-Save-if-Save-Queue-is-full.patch +++ b/Spigot-Server-Patches/0144-Prevent-Auto-Save-if-Save-Queue-is-full.patch @@ -1,4 +1,4 @@ -From 5022fe8950e4040dd0ee1bb63706eeec718ccee1 Mon Sep 17 00:00:00 2001 +From b6fecf06db9aee33bb51e92efde67fd42ae5e0a2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Nov 2016 21:52:22 -0400 Subject: [PATCH] Prevent Auto Save if Save Queue is full @@ -41,10 +41,10 @@ index 7a972f4187..87744dcbfc 100644 Chunk chunk = (Chunk) objectiterator.next(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index fde80d1fd3..3283b5047d 100644 +index 8e14f8c56c..2415404d69 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -141,6 +141,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -148,6 +148,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } diff --git a/Spigot-Server-Patches/0145-Chunk-Save-Stats-Debug-Option.patch b/Spigot-Server-Patches/0145-Chunk-Save-Stats-Debug-Option.patch index 7995ad8fcd..ccfd7b9dca 100644 --- a/Spigot-Server-Patches/0145-Chunk-Save-Stats-Debug-Option.patch +++ b/Spigot-Server-Patches/0145-Chunk-Save-Stats-Debug-Option.patch @@ -1,4 +1,4 @@ -From 2ec23d4415fa7cdff14d42f5f46c1b11eea99c63 Mon Sep 17 00:00:00 2001 +From 2d9b0defd0f78c56f370a94e16e02ea6b6ee6bdc Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 4 Nov 2016 02:12:10 -0400 Subject: [PATCH] Chunk Save Stats Debug Option @@ -54,10 +54,10 @@ index 87744dcbfc..355186c111 100644 return false; } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 3283b5047d..110c9ef520 100644 +index 2415404d69..f099b91f7a 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -141,7 +141,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -148,7 +148,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } @@ -72,16 +72,16 @@ index 3283b5047d..110c9ef520 100644 // CraftBukkit start - Add async variant, provide compatibility @Nullable -@@ -331,6 +337,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -338,6 +344,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } protected void a(ChunkCoordIntPair chunkcoordintpair, Supplier nbttagcompound) { // Spigot + queuedSaves++; // Paper - synchronized (this.queue) { // Paper - synchronize while modifying the map + synchronized (this.b) { // Paper - synchronize while modifying the map queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements this.b.put(chunkcoordintpair, nbttagcompound); -@@ -356,6 +363,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - } else { +@@ -369,6 +376,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + // Paper end ChunkCoordIntPair chunkcoordintpair = chunk.coords; // Paper - Chunk queue improvements Supplier nbttagcompound = chunk.compoundSupplier; // Spigot // Paper + processedSaves.incrementAndGet(); // Paper diff --git a/Spigot-Server-Patches/0302-Don-t-save-Proto-Chunks.patch b/Spigot-Server-Patches/0302-Don-t-save-Proto-Chunks.patch index dc7102b084..5c7cf86f69 100644 --- a/Spigot-Server-Patches/0302-Don-t-save-Proto-Chunks.patch +++ b/Spigot-Server-Patches/0302-Don-t-save-Proto-Chunks.patch @@ -1,4 +1,4 @@ -From 8bd54fac08b3ade04b63583ce9d8cc2173fa851f Mon Sep 17 00:00:00 2001 +From d15c2067a5b8cb216de1effc12c85f838d1d7cf6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 22 Jul 2018 21:21:41 -0400 Subject: [PATCH] Don't save Proto Chunks @@ -8,10 +8,10 @@ the loadChunk method refuses to acknoledge they exists, and will restart a new chunk generation process to begin with, so saving them serves no benefit. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 110c9ef520..3074aa50e8 100644 +index f099b91f7a..ec94b9fe57 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -289,6 +289,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -296,6 +296,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } public void saveChunk(World world, IChunkAccess ichunkaccess, boolean unloaded) throws IOException, ExceptionWorldConflict { diff --git a/Spigot-Server-Patches/0311-Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/0311-Prevent-Saving-Bad-entities-to-chunks.patch index b56fdc1bf0..098475fe2d 100644 --- a/Spigot-Server-Patches/0311-Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/0311-Prevent-Saving-Bad-entities-to-chunks.patch @@ -1,4 +1,4 @@ -From cd080ccdb7fb13e2b2458e8d97a64575a61fbec3 Mon Sep 17 00:00:00 2001 +From c107796d25c4e33e47ab6c832793f350c9ebbad0 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 26 Jul 2018 00:11:12 -0400 Subject: [PATCH] Prevent Saving Bad entities to chunks @@ -18,10 +18,10 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 4f0571ae26..b0fa23db5e 100644 +index ec94b9fe57..e6ede2cc25 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -548,11 +548,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -561,11 +561,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { Iterator iterator; @@ -44,7 +44,7 @@ index 4f0571ae26..b0fa23db5e 100644 NBTTagCompound nbttagcompound1 = new NBTTagCompound(); if (entity.d(nbttagcompound1)) { -@@ -561,6 +572,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -574,6 +585,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } } diff --git a/Spigot-Server-Patches/0316-Provide-option-to-use-a-versioned-world-folder-for-t.patch b/Spigot-Server-Patches/0316-Provide-option-to-use-a-versioned-world-folder-for-t.patch index cd8962a54a..a1561ad10f 100644 --- a/Spigot-Server-Patches/0316-Provide-option-to-use-a-versioned-world-folder-for-t.patch +++ b/Spigot-Server-Patches/0316-Provide-option-to-use-a-versioned-world-folder-for-t.patch @@ -1,4 +1,4 @@ -From 418328efab0770b7cbfe3eff814e54a7314731d1 Mon Sep 17 00:00:00 2001 +From 132c87e612eeb913dc0a57cde399bf0519c66a04 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 29 Jul 2018 15:48:50 -0400 Subject: [PATCH] Provide option to use a versioned world folder for testing @@ -59,10 +59,10 @@ index bcdf4f91d8..c457d07110 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index ffa94ea674..68a3169c31 100644 +index e6ede2cc25..93bc613958 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -52,8 +52,52 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -59,8 +59,52 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { private PersistentStructureLegacy e; // private boolean f; // CraftBukkit private static final double SAVE_QUEUE_TARGET_SIZE = 625; // Spigot @@ -115,7 +115,7 @@ index ffa94ea674..68a3169c31 100644 this.c = file; this.d = datafixer; } -@@ -72,7 +116,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -79,7 +123,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } @@ -124,7 +124,7 @@ index ffa94ea674..68a3169c31 100644 NBTTagCompound nbt = RegionFileCache.read(this.c, x, z); if (nbt != null) { NBTTagCompound level = nbt.getCompound("Level"); -@@ -92,6 +136,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -99,6 +143,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @Nullable private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j, @Nullable GeneratorAccess generatoraccess) throws IOException { @@ -132,7 +132,7 @@ index ffa94ea674..68a3169c31 100644 NBTTagCompound nbttagcompound = SupplierUtils.getIfExists(this.b.get(new ChunkCoordIntPair(i, j))); // Spigot if (nbttagcompound != null) { -@@ -215,6 +260,15 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -222,6 +267,15 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } diff --git a/Spigot-Server-Patches/0346-Anti-Xray.patch b/Spigot-Server-Patches/0346-Anti-Xray.patch index 568094830c..bec13b4cd2 100644 --- a/Spigot-Server-Patches/0346-Anti-Xray.patch +++ b/Spigot-Server-Patches/0346-Anti-Xray.patch @@ -1,4 +1,4 @@ -From 5b3c1c01e0892270eff2bcea0209bf5e5c0fd39d Mon Sep 17 00:00:00 2001 +From 4ebd487261fd788fcb42a4d09d156e5acdf50ccd Mon Sep 17 00:00:00 2001 From: stonar96 Date: Mon, 20 Aug 2018 03:03:58 +0200 Subject: [PATCH] Anti-Xray @@ -1071,10 +1071,10 @@ index 56c3783412..f3d9211baa 100644 this.initLighting(); } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 90e6de419e..538e4b04d9 100644 +index 93bc613958..31faeb43f6 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -844,7 +844,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -857,7 +857,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a; @@ -1083,7 +1083,7 @@ index 90e6de419e..538e4b04d9 100644 protochunk.a(abiomebase); protochunk.b(nbttagcompound.getLong("InhabitedTime")); -@@ -950,7 +950,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -963,7 +963,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompound(i); byte b0 = nbttagcompound.getByte("Y");