Forgot to rebuild patches after I fixed things in upstream update

This commit is contained in:
Aikar
2018-09-09 15:29:22 -04:00
parent 2041815962
commit d039f43117
8 changed files with 34 additions and 12 deletions

View File

@@ -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
@@ -0,0 +0,0 @@ import java.util.function.Consumer;
@@ -60,6 +60,13 @@ index 2e9bd0949a..3166d4b1ad 100644
+ private static class QueuedChunk {
+ public ChunkCoordIntPair coords;
+ public Supplier<NBTTagCompound> compoundSupplier;
+ public Runnable onSave;
+
+ public QueuedChunk(Runnable run) {
+ this.coords = null;
+ this.compoundSupplier = null;
+ this.onSave = run;
+ }
+
+ public QueuedChunk(ChunkCoordIntPair coords, Supplier<NBTTagCompound> compoundSupplier) {
+ this.coords = coords;
@@ -88,7 +95,7 @@ index 2e9bd0949a..3166d4b1ad 100644
protected void a(ChunkCoordIntPair chunkcoordintpair, Supplier<NBTTagCompound> 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);
+ }
@@ -117,6 +124,12 @@ index 2e9bd0949a..3166d4b1ad 100644
- iterator.remove();
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) entry.getKey();
- Supplier<NBTTagCompound> nbttagcompound = (Supplier<NBTTagCompound>) 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> nbttagcompound = chunk.compoundSupplier; // Spigot // Paper
@@ -127,7 +140,7 @@ index 2e9bd0949a..3166d4b1ad 100644
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();
@@ -0,0 +0,0 @@ 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