|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.aranai.dungeonator.dungeonchunk.DungeonChunkManager
public class DungeonChunkManager
Handles storage and access for DungeonChunks via a local cache. The DungeonChunkManager interfaces with the DungeonDataManager for data store abstraction, and the DungeonChunkGenerator for new chunk generation.
Field Summary | |
---|---|
private java.util.concurrent.ConcurrentHashMap<java.lang.String,DungeonChunk> |
chunkCache
Local cache of dungeon chunk information. |
private DungeonChunkGenerator |
chunkGenerator
DungeonChunkGenerator instance |
private DungeonDataManager |
dataManager
DungeonDataManager instance |
Constructor Summary | |
---|---|
DungeonChunkManager(DungeonDataManager dataManager)
Instantiates the dungeon chunk manager. |
Method Summary | |
---|---|
void |
generateChunk(java.lang.String world,
int x,
int z,
org.bukkit.Chunk chunk)
Generate a DungeonChunk for the specified Chunk. |
private DungeonChunk |
getCachedChunk(java.lang.String hash)
Gets a cached DungeonChunk based on its hash code |
private DungeonChunk |
getCachedChunk(java.lang.String world,
int x,
int z)
Gets a cached DungeonChunk based on world, x and z coordinates
Convenience alias for getCachedChunk(String) . |
DungeonChunk |
getChunk(java.lang.String hash)
Gets the DungeonChunk for the specified coordinates |
DungeonChunk |
getChunk(java.lang.String world,
int x,
int z)
Gets a DungeonChunk matching the specified coordinates. |
java.lang.String |
getChunkHash(java.lang.String world,
int x,
int z)
Gets a chunk hash based on world name, x and z coordinates. |
boolean |
isChunkCached(java.lang.String hash)
Checks if the chunk is cached. |
boolean |
isChunkCached(java.lang.String world,
int x,
int z)
Checks if the chunk is cached. |
boolean |
isChunkGenerated(java.lang.String world,
int x,
int z)
Checks if a DungeonChunk has been generated for the specified Chunk. |
void |
loadChunk(java.lang.String hash,
org.bukkit.Chunk chunkData)
Load a DungeonChunk from the local cache or the data store. |
void |
loadChunk(java.lang.String world,
int x,
int z,
org.bukkit.Chunk chunkData)
Load a DungeonChunk from the local cache or the data store. |
void |
storeChunk(DungeonChunk chunk)
Stores and caches the Dungeonator-specific chunk data. |
void |
updateCachedChunk(DungeonChunk chunk)
Save a DungeonChunk to the local cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.concurrent.ConcurrentHashMap<java.lang.String,DungeonChunk> chunkCache
private DungeonDataManager dataManager
private DungeonChunkGenerator chunkGenerator
Constructor Detail |
---|
public DungeonChunkManager(DungeonDataManager dataManager)
Method Detail |
---|
public void storeChunk(DungeonChunk chunk)
chunk
- the DungeonChunk to storeDungeonChunk
public void updateCachedChunk(DungeonChunk chunk)
DungeonChunk
to the local cache.
chunk
- the DungeonChunk to savepublic void loadChunk(java.lang.String world, int x, int z, org.bukkit.Chunk chunkData)
DungeonChunk
from the local cache or the data store.
Convenience alias for #loadChunk(String)
world
- the world in which the chunk is locatedx
- the x coordinate for the chunkz
- the z coordinate for the chunkchunk
- the chunk datapublic void loadChunk(java.lang.String hash, org.bukkit.Chunk chunkData)
DungeonChunk
from the local cache or the data store.
hash
- the hash for the DungeonChunkpublic DungeonChunk getChunk(java.lang.String world, int x, int z)
DungeonChunk
matching the specified coordinates.
Convenience alias for getChunk(String)
world
- the world for the chunkx
- the x coordinate for the chunkz
- the z coordinate for the chunk
public DungeonChunk getChunk(java.lang.String hash)
DungeonChunk
for the specified coordinates
hash
- the hash for the chunk
getChunkHash(String, int, int)
private DungeonChunk getCachedChunk(java.lang.String world, int x, int z)
DungeonChunk
based on world, x and z coordinates
Convenience alias for getCachedChunk(String)
.
world
- the worldx
- the x coordinatez
- the z coordinate
private DungeonChunk getCachedChunk(java.lang.String hash)
DungeonChunk
based on its hash code
hash
- the hash for the DungeonChunk
getChunkHash(String, int, int)
public java.lang.String getChunkHash(java.lang.String world, int x, int z)
world
- the world namex
- the x coordinatez
- the z coordinate
public boolean isChunkCached(java.lang.String world, int x, int z)
isChunkCached(String)
world
- the world namex
- the x coordinate for the chunkz
- the z coordinate for the chunk
public boolean isChunkCached(java.lang.String hash)
hash
- the hash for the chunk
public boolean isChunkGenerated(java.lang.String world, int x, int z)
world
- the worldx
- the x coordinate for the chunkz
- the z coordinate for the chunk
public void generateChunk(java.lang.String world, int x, int z, org.bukkit.Chunk chunk)
world
- the world namex
- the x coordinate for the chunkz
- the z coordinate for the chunkchunk
- the handle for the chunk
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |