mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
Threadsafe World.c(int i, int j)
This commit is contained in:
parent
96794e15db
commit
a52f5ef520
@ -286,13 +286,18 @@ public class World implements IBlockAccess {
|
||||
Chunk lastChunkAccessed;
|
||||
int lastXAccessed = Integer.MIN_VALUE;
|
||||
int lastZAccessed = Integer.MIN_VALUE;
|
||||
final Object chunkLock = new Object();
|
||||
public Chunk c(int i, int j) {
|
||||
if(lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
||||
Chunk result = null;
|
||||
synchronized (chunkLock) {
|
||||
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
||||
lastXAccessed = i;
|
||||
lastZAccessed = j;
|
||||
lastChunkAccessed = this.G.b(i, j);
|
||||
}
|
||||
return lastChunkAccessed;
|
||||
result = lastChunkAccessed;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user