Modifier and Type | Class and Description |
---|---|
static class |
ChunkManager.ChunkLock
A group of locks on chunks to prevent them from being unloaded while in use.
|
Constructor and Description |
---|
ChunkManager(GlowWorld world,
ChunkIoService service,
org.bukkit.generator.ChunkGenerator generator)
Creates a new chunk manager with the specified I/O service and world generator.
|
Modifier and Type | Method and Description |
---|---|
void |
broadcastBlockChange(GlowChunk.Key key,
BlockChangeMessage message)
Queues block change notification to all players in this chunk
|
void |
broadcastBlockChanges(GlowChunk.Key key,
Iterable<BlockChangeMessage> messages)
Queues block change notification to all players in this chunk
|
void |
clearChunkBlockChanges() |
void |
forcePopulation(int x,
int z)
Force a chunk to be populated by loading the chunks in an area around it.
|
boolean |
forceRegeneration(int x,
int z)
Forces generation of the given chunk.
|
int[] |
getBiomeGrid(int x,
int z,
int sizeX,
int sizeZ) |
int[] |
getBiomeGridAtLowerRes(int x,
int z,
int sizeX,
int sizeZ) |
List<BlockChangeMessage> |
getBlockChanges(GlowChunk.Key key) |
GlowChunk |
getChunk(GlowChunk.Key key)
Gets a chunk object from its key, which might not yet be loaded.
|
GlowChunk |
getChunk(int x,
int z)
Gets a chunk object representing the specified coordinates, which might not yet be loaded.
|
org.bukkit.generator.ChunkGenerator |
getGenerator()
The chunk generator used to generate new chunks.
|
GlowChunk[] |
getLoadedChunks()
Gets a list of loaded chunks.
|
boolean |
isChunkInUse(int x,
int z)
Check whether a chunk has locks on it preventing it from being unloaded.
|
boolean |
isChunkLoaded(int x,
int z)
Checks if the Chunk at the specified coordinates is loaded.
|
boolean |
loadChunk(GlowChunk chunk,
boolean generate)
Attempts to load a chunk; handles exceptions.
|
boolean |
loadChunk(int x,
int z,
boolean generate)
Call the ChunkIoService to load a chunk, optionally generating the chunk.
|
boolean |
performSave(GlowChunk chunk)
Performs the save for the given chunk using the storage provider.
|
void |
unloadOldChunks()
Unload chunks with no locks on them.
|
public ChunkManager(GlowWorld world, ChunkIoService service, org.bukkit.generator.ChunkGenerator generator)
world
- The chunk manager's world.service
- The I/O service.generator
- The world generator.public GlowChunk getChunk(int x, int z)
x
- The X coordinate.z
- The Z coordinate.public GlowChunk getChunk(GlowChunk.Key key)
key
- The x, y key of the chunk.public boolean isChunkLoaded(int x, int z)
x
- The X coordinate.z
- The Z coordinate.public boolean isChunkInUse(int x, int z)
x
- The X coordinate.z
- The Z coordinate.public boolean loadChunk(int x, int z, boolean generate)
x
- The X coordinate of the chunk to load.z
- The Y coordinate of the chunk to load.generate
- Whether to generate the chunk if needed.public boolean loadChunk(GlowChunk chunk, boolean generate)
chunk
- the chunk addressgenerate
- if true, generate the chunk if it's new or the saved copy is corruptedpublic void unloadOldChunks()
public void forcePopulation(int x, int z)
x
- The X coordinate.z
- The Z coordinate.public boolean forceRegeneration(int x, int z)
x
- The X coordinate.z
- The Z coordinate.public GlowChunk[] getLoadedChunks()
public boolean performSave(GlowChunk chunk)
chunk
- The chunk to save.public int[] getBiomeGridAtLowerRes(int x, int z, int sizeX, int sizeZ)
public int[] getBiomeGrid(int x, int z, int sizeX, int sizeZ)
public void broadcastBlockChange(GlowChunk.Key key, BlockChangeMessage message)
key
- The chunk's keymessage
- The block change message to broadcastpublic void broadcastBlockChanges(GlowChunk.Key key, Iterable<BlockChangeMessage> messages)
key
- The chunk's keymessages
- The block change messages to broadcastpublic List<BlockChangeMessage> getBlockChanges(GlowChunk.Key key)
public void clearChunkBlockChanges()
public org.bukkit.generator.ChunkGenerator getGenerator()
Copyright © 2021. All rights reserved.