Created methods that load and unload chunks
This commit is contained in:
parent
ddb27a4752
commit
4dd1048994
1 changed files with 26 additions and 0 deletions
|
@ -1,5 +1,31 @@
|
||||||
package iieLoadSaveEntireWorld;
|
package iieLoadSaveEntireWorld;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class ChunkLoaderAPI {
|
public class ChunkLoaderAPI {
|
||||||
|
/**This method loads a chunk if the chunk isn't loaded already.
|
||||||
|
* @param locationToLoad
|
||||||
|
* @return True if chunk was already loaded, False if chunk wasn't already loaded
|
||||||
|
*/
|
||||||
|
public static boolean loadChunk(Location locationToLoad){
|
||||||
|
if(!(locationToLoad.getBlock().getChunk().isLoaded())){
|
||||||
|
locationToLoad.getBlock().getChunk().load();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**This method loads a chunk if the chunk isn't loaded already.
|
||||||
|
* @param locationToLoad
|
||||||
|
* @return True if chunk was already unloaded, False if chunk wasn't already unloaded
|
||||||
|
*/
|
||||||
|
public static boolean unloadChunk(Location locationToUnload){
|
||||||
|
if (locationToUnload.getBlock().getChunk().isLoaded()){
|
||||||
|
locationToUnload.getBlock().getChunk().unload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue