Class DevPlanet

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

public class DevPlanet extends Object

DevPlanet

This class represents developer's world, where players can edit and change code with blocks on platform.

Platform consists of white, blue and gray stained-glass, and it can't be destroyed. Players can place chests, shulkers, signs and anvils on white stained-glass. On blue stained-glass players should place executor blocks, on gray stained-glass - actions and conditions.

  • Constructor Details

    • DevPlanet

      public DevPlanet(@NotNull @NotNull Planet planet)
      Constructor of developer planet, that loads settings from config.
      Parameters:
      planet - planet, that owns this developer planet.
  • Method Details

    • getDefaultActionMaterial

      @NotNull public static @NotNull org.bukkit.Material getDefaultActionMaterial()
      Returns default action block material, used for creating new coding platforms.

      This material must be solid, so players will be able to place action blocks on it.

      Returns:
      default action block material.
    • getDefaultEventMaterial

      @NotNull public static @NotNull org.bukkit.Material getDefaultEventMaterial()
      Returns default event block material, used for creating new coding platforms.

      This material must be solid, so players will be able to place event blocks on it.

      Returns:
      default event block material.
    • getDefaultFloorMaterial

      @NotNull public static @NotNull org.bukkit.Material getDefaultFloorMaterial()
      Returns default floor block material, used for creating new coding platforms.

      This material must be solid, so players will be able to place allowed blocks on it.

      Returns:
      default floor block material.
    • load

      @NotNull public @NotNull CompletableFuture<org.bukkit.World> load()
      Loads developer's world and setups it.
    • unload

      @NotNull public @NotNull CompletableFuture<Void> unload()
      Unloads developer's world and teleports all players in it to lobby.
    • unload

      @NotNull public @NotNull CompletableFuture<Void> unload(boolean asyncSave)
      Unloads developer's world and teleports all players in it to lobby.
      Parameters:
      asyncSave - true - will save world later, false - immediately.
    • setupWorld

      public void setupWorld(@NotNull @NotNull org.bukkit.World world)
      Setups developer's world, changes spawn location, sets game rules and world border.
    • exists

      public boolean exists()
      Checks whether developer planet was generated before.
      Returns:
      true - exists, false - not created yet.
    • getAllCodingBlocksForPlacing

      @NotNull public @NotNull Set<org.bukkit.Material> getAllCodingBlocksForPlacing()
    • getEventsBlocks

      @NotNull public @NotNull Set<org.bukkit.Material> getEventsBlocks()
    • getActionsBlocks

      @NotNull public @NotNull Set<org.bukkit.Material> getActionsBlocks()
    • createPlatform

      public boolean createPlatform(int platformX, int platformZ)
      Creates a coding platform with specified X and Z of platform.

      By default, it generates floor with white stained-glass, and fills executor sections with blue stained-glass, action sections with gray stained-glass.

      Parameters:
      platformX - X number of platform.
      platformZ - Z number of platform.
      Returns:
      true - if successfully created, false - if failed.
    • claimPlatform

      public boolean claimPlatform(@NotNull @NotNull DevPlatform platform, @NotNull @NotNull org.bukkit.entity.Player player)
      Claims new platform and teleports player to it.
      Parameters:
      platform - platform to claim.
      player - player, who will be teleported.
      Returns:
      true - claimed coding platform, false - already built and exists.
    • getIndestructibleBlocks

      @NotNull public @NotNull Set<org.bukkit.Material> getIndestructibleBlocks()
    • getAllowedBlocks

      @NotNull public @NotNull Set<org.bukkit.Material> getAllowedBlocks()
    • getPlacedExecutors

      @NotNull public @NotNull List<org.bukkit.Location> getPlacedExecutors(ExecutorCategory category)
    • getPlacedFunctions

      @NotNull public @NotNull List<org.bukkit.Location> getPlacedFunctions()
    • getPlacedMethods

      @NotNull public @NotNull List<org.bukkit.Location> getPlacedMethods()
    • updateContainers

      public void updateContainers()
    • updateSigns

      public void updateSigns()
    • getWorldUUID

      @Nullable public @Nullable UUID getWorldUUID()
      Returns unique ID of loaded developer world.
      Returns:
      uuid of world, null - if not loaded.
    • setWorld

      public void setWorld(@Nullable @Nullable UUID uuid)
      Sets a unique ID of loaded developer world.
      Parameters:
      uuid - uuid of world, null - if not loaded.
    • isLoaded

      public boolean isLoaded()
      Checks whether developer world is loaded.
      Returns:
      true - is loaded, false - unloaded.
    • getOpenedMenu

      @Nullable public @Nullable Layout getOpenedMenu(@NotNull @NotNull org.bukkit.Location location)
    • registerOpenedMenu

      public void registerOpenedMenu(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull Layout menu)
    • unregisterOpenedMenu

      public void unregisterOpenedMenu(@NotNull @NotNull org.bukkit.Location location)
    • getContainerMaterial

      @NotNull public @NotNull org.bukkit.Material getContainerMaterial()
    • getSignMaterial

      @NotNull public @NotNull org.bukkit.Material getSignMaterial()
    • isNightVision

      public boolean isNightVision()
    • setNightVision

      public void setNightVision(boolean nightVision)
    • isSaveLocation

      public boolean isSaveLocation()
    • setSaveLocation

      public void setSaveLocation(boolean saveLocation)
    • isDropItems

      public boolean isDropItems()
    • setDropItems

      public void setDropItems(boolean dropItems)
    • setPlatformerID

      public void setPlatformerID(@NotNull @NotNull String platformer)
    • setContainerMaterial

      public boolean setContainerMaterial(org.bukkit.Material containerMaterial)
    • setSignMaterial

      public boolean setSignMaterial(org.bukkit.Material signMaterial)
    • getWorldName

      @NotNull public @NotNull String getWorldName()
    • getPlatforms

      @NotNull public @NotNull List<DevPlatform> getPlatforms()
      Returns list of existing coding platforms, that can be used to place coding blocks.
      Returns:
      list of developer platforms.
    • getPlatformInLocation

      @Nullable public @Nullable DevPlatform getPlatformInLocation(@NotNull @NotNull org.bukkit.Location location)
      Returns coding platform by location.
      Parameters:
      location - location to get platform.
      Returns:
      coding platform - if location contains coding platform, otherwise - null.
    • displayWorldBorders

      public void displayWorldBorders()
      Changes world border for all players inside developer world, used when some player joins the developer world.
    • getDevPlatformer

      @NotNull public @NotNull DevPlatformer getDevPlatformer()
    • getLastLocations

      @NotNull public @NotNull Map<UUID,org.bukkit.Location> getLastLocations()
    • getMarkedExecutors

      @NotNull public @NotNull Set<org.bukkit.Location> getMarkedExecutors(@NotNull @NotNull org.bukkit.entity.Player player)
    • markExecutorAsSelected

      public void markExecutorAsSelected(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Location location)
      Adds executor to marked list for player, when they click it with manipulator item.
      Parameters:
      player - player, who just marked executor.
      location - location of executor block.
    • unselectMarkedExecutor

      public void unselectMarkedExecutor(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Location location)
      Removes marked executor for player, who selected it with manipulator item.
      Parameters:
      player - player, who marked executor before.
      location - location of executor block.
    • clearMarkedExecutors

      public void clearMarkedExecutors(@NotNull @NotNull org.bukkit.Location location)
      Removes marked executor for all players, who selected it with manipulator item.
      Parameters:
      location - location of executor block.
    • isCodeChanged

      public boolean isCodeChanged()
      Returns whether code was changed after last parsing and saving.
      Returns:
      true - code was changed, false - not changed.
    • isCurrentlySavingCode

      public boolean isCurrentlySavingCode()
      Checks whether code is currently being saved to file or not.
      Returns:
      true - is busy, false - not.
    • setCurrentlySavingCode

      public void setCurrentlySavingCode(boolean currentlySavingCode)
      Sets the state of saving code. If true, it will disallow to save a code.
      Parameters:
      currentlySavingCode - true - set busy state, false - allow to save code.
    • getCodingLineBeginLocation

      @Nullable public @Nullable org.bukkit.Location getCodingLineBeginLocation(@NotNull @NotNull org.bukkit.Location location)
      Returns executor location by location.
      Parameters:
      location - location to get platform.
      Returns:
      executor location - if location is related to actions or its executor location itself.
    • addInsideCodeColumnChange

      public void addInsideCodeColumnChange(@NotNull @NotNull org.bukkit.Location location)
      Adds coding line, that will be parsed on partially code parsing (/play) by getting begin location.
      Parameters:
      location - location on coding line.
    • addChangedColumn

      public void addChangedColumn(@NotNull @NotNull org.bukkit.Location executorLocation)
      Adds coding line, that will be parsed on partially code parsing (/play).
      Parameters:
      executorLocation - location of executor on coding line.
    • getChangedColumns

      @NotNull public @NotNull Set<org.bukkit.Location> getChangedColumns()
      Returns immutable set of executor locations for changed coding lines.
      Returns:
      immutable set of locations with executors.
    • connectPlayer

      public void connectPlayer(@NotNull @NotNull org.bukkit.entity.Player player)
      Connects player to developer's world.
      Parameters:
      player - player to connect.
    • connectPlayer

      public void connectPlayer(@NotNull @NotNull org.bukkit.entity.Player player, boolean hidePlayer)
      Connects player to developer's planet.
      Parameters:
      player - player to connect.
      hidePlayer - whether hide player's join message and make him in spectator mode or not.
    • connectPlayer

      public void connectPlayer(@NotNull @NotNull org.bukkit.entity.Player player, double x, double y, double z)
      Connects player to developer's world, teleports next to block on specified coordinates.

      Will make block glowing.

      Parameters:
      player - player to connect.
      x - x coordinate of block.
      y - y coordinate of block.
      z - z coordinate of block.
    • clearColumnsChanges

      public void clearColumnsChanges()
      Clears set of changed coding lines, so they will be not parsed.
    • clearMarkedExecutors

      public void clearMarkedExecutors(@NotNull @NotNull org.bukkit.entity.Player player)
    • getWorld

      public org.bukkit.World getWorld()
    • getPlanet

      @NotNull public @NotNull Planet getPlanet()