Class PlanetTerritory
java.lang.Object
ua.mcchickenstudio.opencreative.planets.PlanetTerritory
PlanetTerritory
This class represents a territory, where planet players can build or play. It stores one-time information that will be removed on world unloading.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBukkitRunnable(org.bukkit.scheduler.BukkitRunnable runnable) voidClears temporary information stored in memory.@Nullable org.bukkit.WorldgenerateWorld(WorldGenerator generator, org.bukkit.World.Environment environment, long seed, boolean generateStructures, String biome) Returns map of IDs and boss bars.org.bukkit.World.EnvironmentgetFlags()Returns flags of planet, that store additional settings.@NotNull PlanetRecipesReturns recipes of planet.@NotNull PlanetScoreboardsReturns scoreboards of planet.@NotNull CodeScriptReturns code script of world, that stores executors and actions.@NotNull org.bukkit.LocationReturns spawn location, where players should appear after connecting to planet.@Nullable org.bukkit.WorldgetWorld()Returns world of planet for buildings.intReturns size of world, that will be used to set world borders.booleanChecks whether world should save territory changes.booleanisBusy()Checks whether world is busy for deleting or unloading, so players shouldn't be able to join it.booleanChecks whether world will be not unloaded by unload request.voidload()Loads planet's files into worlds directory, loads and setups build world, loads script and variables.voidremoveBukkitRunnable(org.bukkit.scheduler.BukkitRunnable runnable) voidResets custom world size to owner's group world size.voidscheduleAsyncRunnable(@NotNull PlanetRunnable runnable, long delay) voidscheduleRunnable(@NotNull PlanetRunnable runnable, long delay) voidsetAutoSave(boolean autoSave) Sets auto-save option to specified value.voidsetGameRuleIfExists(@NotNull String gameRule, boolean value) voidsetGameRuleIfExists(@NotNull String gameRule, int value) voidsetIgnoreUnloading(boolean ignoreUnloading) Sets whether world should ignore unloading.voidsetSpawnLocation(@NotNull org.bukkit.Location spawnLocation) Sets new spawn location for planet, where player will appear after joining to planet.voidsetWorldSize(int size, boolean save) Sets custom size of world borders.voidshowBorders(@NotNull org.bukkit.entity.Player player) Shows custom world borders for player.voidStops all running bukkit runnables and tasks in world.voidunload()Saves planet's data and unloads planet's build and dev world.
-
Constructor Details
-
PlanetTerritory
-
-
Method Details
-
resetWorldSize
public void resetWorldSize()Resets custom world size to owner's group world size. -
setWorldSize
public void setWorldSize(int size, boolean save) Sets custom size of world borders.- Parameters:
size- new size of world.save- whether ignore size from owner's group on next world load and use specified.
-
load
public void load()Loads planet's files into worlds directory, loads and setups build world, loads script and variables. -
unload
public void unload()Saves planet's data and unloads planet's build and dev world. -
clearData
public void clearData()Clears temporary information stored in memory. Used on world unload. -
addBukkitRunnable
public void addBukkitRunnable(org.bukkit.scheduler.BukkitRunnable runnable) -
scheduleRunnable
-
scheduleAsyncRunnable
-
removeBukkitRunnable
public void removeBukkitRunnable(org.bukkit.scheduler.BukkitRunnable runnable) -
stopBukkitRunnables
public void stopBukkitRunnables()Stops all running bukkit runnables and tasks in world. -
getFlags
Returns flags of planet, that store additional settings.- Returns:
- planet's flags.
-
getBossBars
-
getEnvironment
public org.bukkit.World.Environment getEnvironment() -
getWorld
@Nullable public @Nullable org.bukkit.World getWorld()Returns world of planet for buildings. If world is unloaded, returns null.- Returns:
- planet's world, or null - if world is unloaded.
-
getWorldSize
public int getWorldSize()Returns size of world, that will be used to set world borders.- Returns:
- size of world.
-
getScript
Returns code script of world, that stores executors and actions.- Returns:
- code script.
-
generateWorld
@Nullable public @Nullable org.bukkit.World generateWorld(WorldGenerator generator, org.bukkit.World.Environment environment, long seed, boolean generateStructures, String biome) -
setGameRuleIfExists
-
setGameRuleIfExists
-
showBorders
public void showBorders(@NotNull @NotNull org.bukkit.entity.Player player) Shows custom world borders for player.- Parameters:
player- player to show.
-
getScoreboards
Returns scoreboards of planet.- Returns:
- planet's scoreboards.
-
getRecipes
Returns recipes of planet.- Returns:
- planet's recipes.
-
getSpawnLocation
@NotNull public @NotNull org.bukkit.Location getSpawnLocation()Returns spawn location, where players should appear after connecting to planet.- Returns:
- spawn location of planet
-
setSpawnLocation
public void setSpawnLocation(@NotNull @NotNull org.bukkit.Location spawnLocation) Sets new spawn location for planet, where player will appear after joining to planet.- Parameters:
spawnLocation- new spawn location.
-
isAutoSave
public boolean isAutoSave()Checks whether world should save territory changes.- Returns:
- true - will be saved, false - not.
-
isBusy
public boolean isBusy()Checks whether world is busy for deleting or unloading, so players shouldn't be able to join it.- Returns:
- true - is busy, false - not.
-
setIgnoreUnloading
public void setIgnoreUnloading(boolean ignoreUnloading) Sets whether world should ignore unloading.- Parameters:
ignoreUnloading- ignore unloading.
-
isIgnoringUnload
public boolean isIgnoringUnload()Checks whether world will be not unloaded by unload request.- Returns:
- true - world cannot be unloaded, false - can be.
-
setAutoSave
public void setAutoSave(boolean autoSave) Sets auto-save option to specified value.- Parameters:
autoSave- true - build world changes will be saved.false - build world changes will be not saved.
-