diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java index 91cb8a4f..f45a2c9c 100644 --- a/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java @@ -58,4 +58,50 @@ public interface Chunk { Entity[] getEntities(); BlockState[] getTileEntities(); + + /** + * Checks if the chunk is loaded. + * + * @return + */ + boolean isLoaded(); + + /** + * Loads the chunk. + * + * @param generate Whether or not to generate a chunk if it doesn't already exist + * @return true if the chunk has loaded successfully, otherwise false + */ + boolean load(boolean generate); + + /** + * Loads the chunk. + * + * @return true if the chunk has loaded successfully, otherwise false + */ + boolean load(); + + /** + * Unloads and optionally saves the Chunk + * + * @param save Controls whether the chunk is saved + * @param safe Controls whether to unload the chunk when players are nearby + * @return true if the chunk has unloaded successfully, otherwise false + */ + boolean unload(boolean save, boolean safe); + + /** + * Unloads and optionally saves the Chunk + * + * @param save Controls whether the chunk is saved + * @return true if the chunk has unloaded successfully, otherwise false + */ + boolean unload(boolean save); + + /** + * Unloads and optionally saves the Chunk + * + * @return true if the chunk has unloaded successfully, otherwise false + */ + boolean unload(); } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index b09fb131..b8330493 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -171,6 +171,16 @@ public interface World { */ public boolean loadChunk(int x, int z, boolean generate); + /** + * Safely unloads and saves the {@link Chunk} at the specified coordinates + * + * This method is analogous to {@link #unloadChunk(int, int, boolean, boolean)} where safe and saveis true + * + * @param chunk the chunk to unload + * @return true if the chunk has unloaded successfully, otherwise false + */ + public boolean unloadChunk(Chunk chunk); + /** * Safely unloads and saves the {@link Chunk} at the specified coordinates *