mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-29 15:07:36 +02:00
The chunk caching method is now thread safe
This commit is contained in:
parent
6e9e6be1fe
commit
623a6eb783
@ -517,9 +517,16 @@ public class InstanceContainer extends Instance {
|
||||
this.sharedInstances.add(sharedInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {@link Chunk} to the internal instance map
|
||||
*
|
||||
* @param chunk the chunk to cache
|
||||
*/
|
||||
private void cacheChunk(Chunk chunk) {
|
||||
final long index = ChunkUtils.getChunkIndex(chunk.getChunkX(), chunk.getChunkZ());
|
||||
this.chunks.put(index, chunk);
|
||||
synchronized (chunks) {
|
||||
this.chunks.put(index, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user