Class PlanetTerritory

java.lang.Object
ua.mcchickenstudio.opencreative.planets.PlanetTerritory

public class PlanetTerritory extends Object

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 Details

    • PlanetTerritory

      public PlanetTerritory(@NotNull @NotNull Planet planet)
  • 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

      public void scheduleRunnable(@NotNull @NotNull PlanetRunnable runnable, long delay)
    • scheduleAsyncRunnable

      public void scheduleAsyncRunnable(@NotNull @NotNull PlanetRunnable runnable, long delay)
    • removeBukkitRunnable

      public void removeBukkitRunnable(org.bukkit.scheduler.BukkitRunnable runnable)
    • stopBukkitRunnables

      public void stopBukkitRunnables()
      Stops all running bukkit runnables and tasks in world.
    • getFlags

      public PlanetFlags getFlags()
      Returns flags of planet, that store additional settings.
      Returns:
      planet's flags.
    • getBossBars

      public Map<String, net.kyori.adventure.bossbar.BossBar> getBossBars()
      Returns map of IDs and boss bars.
      Returns:
      map of IDs and boss bars.
    • 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

      @NotNull public @NotNull CodeScript 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

      public void setGameRuleIfExists(@NotNull @NotNull String gameRule, boolean value)
    • setGameRuleIfExists

      public void setGameRuleIfExists(@NotNull @NotNull String gameRule, int value)
    • showBorders

      public void showBorders(@NotNull @NotNull org.bukkit.entity.Player player)
      Shows custom world borders for player.
      Parameters:
      player - player to show.
    • getScoreboards

      @NotNull public @NotNull PlanetScoreboards getScoreboards()
      Returns scoreboards of planet.
      Returns:
      planet's scoreboards.
    • getRecipes

      @NotNull public @NotNull PlanetRecipes 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.