Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 19:40:07 +01:00
Hoist out synchronisation from ChunkRegionLoader
Dieser Commit ist enthalten in:
Ursprung
022b8c350a
Commit
7033f180e0
@ -84,7 +84,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -267,6 +291,40 @@
|
||||
@@ -267,6 +291,42 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -112,12 +112,14 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // Moved from unloadChunks above
|
||||
+ chunk.removeEntities();
|
||||
+ if (save) {
|
||||
+ this.saveChunk(chunk);
|
||||
+ synchronized (this.chunkLoader) {
|
||||
+ chunk.removeEntities();
|
||||
+ if (save) {
|
||||
+ this.saveChunk(chunk);
|
||||
+ }
|
||||
+ this.chunks.remove(chunk.chunkKey);
|
||||
+ this.lastChunk = null;
|
||||
+ }
|
||||
+ this.chunks.remove(chunk.chunkKey);
|
||||
+ this.lastChunk = null;
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -1,11 +1,6 @@
|
||||
--- a/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -27,11 +27,11 @@
|
||||
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
- private final Map<ChunkCoordIntPair, NBTTagCompound> b = Maps.newHashMap();
|
||||
+ private final Map<ChunkCoordIntPair, NBTTagCompound> b = java.util.Collections.synchronizedMap(Maps.newHashMap()); // CraftBukkit
|
||||
@@ -31,7 +31,7 @@
|
||||
private final File c;
|
||||
private final DataFixer d;
|
||||
private PersistentStructureLegacy e;
|
||||
@ -170,7 +165,7 @@
|
||||
} else {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
|
||||
|
||||
@@ -217,10 +289,15 @@
|
||||
@@ -217,10 +289,14 @@
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
@ -180,7 +175,6 @@
|
||||
+ }
|
||||
|
||||
+ private boolean processSaveQueueEntry(boolean logCompletion) {
|
||||
+ synchronized (this.b) { // CraftBukkit
|
||||
+ Iterator iterator = this.b.entrySet().iterator();
|
||||
if (!iterator.hasNext()) {
|
||||
- if (this.f) {
|
||||
@ -188,7 +182,7 @@
|
||||
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
|
||||
}
|
||||
|
||||
@@ -236,10 +313,14 @@
|
||||
@@ -236,10 +312,14 @@
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
@ -204,15 +198,7 @@
|
||||
if (this.e != null) {
|
||||
this.e.a(chunkcoordintpair.a());
|
||||
}
|
||||
@@ -250,6 +331,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ } // CraftBukkit
|
||||
}
|
||||
|
||||
private ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
|
||||
@@ -266,15 +348,16 @@
|
||||
@@ -266,15 +346,16 @@
|
||||
|
||||
public void b() {
|
||||
try {
|
||||
@ -232,7 +218,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -303,7 +386,7 @@
|
||||
@@ -303,7 +384,7 @@
|
||||
|
||||
if (abiomebase != null) {
|
||||
for (int k = 0; k < abiomebase.length; ++k) {
|
||||
@ -241,7 +227,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +468,7 @@
|
||||
@@ -385,7 +466,7 @@
|
||||
int[] aint = new int[abiomebase.length];
|
||||
|
||||
for (int i = 0; i < abiomebase.length; ++i) {
|
||||
@ -250,7 +236,7 @@
|
||||
}
|
||||
|
||||
nbttagcompound.setIntArray("Biomes", aint);
|
||||
@@ -487,27 +570,27 @@
|
||||
@@ -487,27 +568,27 @@
|
||||
}
|
||||
|
||||
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
|
||||
@ -284,7 +270,7 @@
|
||||
long i1 = nbttagcompound.getLong("InhabitedTime");
|
||||
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
|
||||
|
||||
@@ -850,17 +933,29 @@
|
||||
@@ -850,17 +931,29 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -316,7 +302,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -874,8 +969,14 @@
|
||||
@@ -874,8 +967,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,7 +318,7 @@
|
||||
Iterator iterator = entity.bP().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -891,7 +992,7 @@
|
||||
@@ -891,7 +990,7 @@
|
||||
boolean flag = false;
|
||||
|
||||
try {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren