Archiviert
13
0

Threadsafe World.c(int i, int j)

Dieser Commit ist enthalten in:
Dinnerbone 2011-02-10 11:56:30 +00:00
Ursprung 96794e15db
Commit a52f5ef520

Datei anzeigen

@ -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) {
Chunk result = null;
synchronized (chunkLock) {
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) { if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
lastXAccessed = i; lastXAccessed = i;
lastZAccessed = j; lastZAccessed = j;
lastChunkAccessed = this.G.b(i, j); lastChunkAccessed = this.G.b(i, j);
} }
return lastChunkAccessed; result = lastChunkAccessed;
}
return result;
} }
// CraftBukkit end // CraftBukkit end