Threadsafe World.c(int i, int j)
Dieser Commit ist enthalten in:
Ursprung
96794e15db
Commit
a52f5ef520
@ -286,13 +286,18 @@ public class World implements IBlockAccess {
|
|||||||
Chunk lastChunkAccessed;
|
Chunk lastChunkAccessed;
|
||||||
int lastXAccessed = Integer.MIN_VALUE;
|
int lastXAccessed = Integer.MIN_VALUE;
|
||||||
int lastZAccessed = Integer.MIN_VALUE;
|
int lastZAccessed = Integer.MIN_VALUE;
|
||||||
|
final Object chunkLock = new Object();
|
||||||
public Chunk c(int i, int j) {
|
public Chunk c(int i, int j) {
|
||||||
if(lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
Chunk result = null;
|
||||||
lastXAccessed = i;
|
synchronized (chunkLock) {
|
||||||
lastZAccessed = j;
|
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
||||||
lastChunkAccessed = this.G.b(i, j);
|
lastXAccessed = i;
|
||||||
|
lastZAccessed = j;
|
||||||
|
lastChunkAccessed = this.G.b(i, j);
|
||||||
|
}
|
||||||
|
result = lastChunkAccessed;
|
||||||
}
|
}
|
||||||
return lastChunkAccessed;
|
return result;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren