geforkt von Mirrors/Paper
Fix bad thread safety in ChunkRegionLoader
Dieser Commit ist enthalten in:
Ursprung
3f5ca5f2a4
Commit
cd367fa4d8
@ -1,6 +1,11 @@
|
|||||||
--- a/net/minecraft/server/ChunkRegionLoader.java
|
--- a/net/minecraft/server/ChunkRegionLoader.java
|
||||||
+++ b/net/minecraft/server/ChunkRegionLoader.java
|
+++ b/net/minecraft/server/ChunkRegionLoader.java
|
||||||
@@ -31,7 +31,7 @@
|
@@ -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
|
||||||
private final File c;
|
private final File c;
|
||||||
private final DataFixer d;
|
private final DataFixer d;
|
||||||
private PersistentStructureLegacy e;
|
private PersistentStructureLegacy e;
|
||||||
@ -165,7 +170,7 @@
|
|||||||
} else {
|
} else {
|
||||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
|
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
|
||||||
|
|
||||||
@@ -217,10 +289,14 @@
|
@@ -217,10 +289,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean a() {
|
public boolean a() {
|
||||||
@ -175,6 +180,7 @@
|
|||||||
+ }
|
+ }
|
||||||
|
|
||||||
+ private boolean processSaveQueueEntry(boolean logCompletion) {
|
+ private boolean processSaveQueueEntry(boolean logCompletion) {
|
||||||
|
+ synchronized (this.b) { // CraftBukkit
|
||||||
+ Iterator iterator = this.b.entrySet().iterator();
|
+ Iterator iterator = this.b.entrySet().iterator();
|
||||||
if (!iterator.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
- if (this.f) {
|
- if (this.f) {
|
||||||
@ -182,7 +188,7 @@
|
|||||||
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
|
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,10 +312,14 @@
|
@@ -236,10 +313,14 @@
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -198,7 +204,15 @@
|
|||||||
if (this.e != null) {
|
if (this.e != null) {
|
||||||
this.e.a(chunkcoordintpair.a());
|
this.e.a(chunkcoordintpair.a());
|
||||||
}
|
}
|
||||||
@@ -266,15 +346,16 @@
|
@@ -250,6 +331,7 @@
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ } // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
|
||||||
|
@@ -266,15 +348,16 @@
|
||||||
|
|
||||||
public void b() {
|
public void b() {
|
||||||
try {
|
try {
|
||||||
@ -218,7 +232,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -303,7 +384,7 @@
|
@@ -303,7 +386,7 @@
|
||||||
|
|
||||||
if (abiomebase != null) {
|
if (abiomebase != null) {
|
||||||
for (int k = 0; k < abiomebase.length; ++k) {
|
for (int k = 0; k < abiomebase.length; ++k) {
|
||||||
@ -227,7 +241,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +466,7 @@
|
@@ -385,7 +468,7 @@
|
||||||
int[] aint = new int[abiomebase.length];
|
int[] aint = new int[abiomebase.length];
|
||||||
|
|
||||||
for (int i = 0; i < abiomebase.length; ++i) {
|
for (int i = 0; i < abiomebase.length; ++i) {
|
||||||
@ -236,7 +250,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
nbttagcompound.setIntArray("Biomes", aint);
|
nbttagcompound.setIntArray("Biomes", aint);
|
||||||
@@ -487,27 +568,27 @@
|
@@ -487,27 +570,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
|
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
|
||||||
@ -270,7 +284,7 @@
|
|||||||
long i1 = nbttagcompound.getLong("InhabitedTime");
|
long i1 = nbttagcompound.getLong("InhabitedTime");
|
||||||
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
|
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
|
||||||
|
|
||||||
@@ -850,17 +931,29 @@
|
@@ -850,17 +933,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -302,7 +316,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,8 +967,14 @@
|
@@ -874,8 +969,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +332,7 @@
|
|||||||
Iterator iterator = entity.bP().iterator();
|
Iterator iterator = entity.bP().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -891,7 +990,7 @@
|
@@ -891,7 +992,7 @@
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren