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

      public static 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

      public static 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

      public static 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.
    • loadDevPlanetWorld

      public void loadDevPlanetWorld()
      Loads developer's world and setups it.
    • unload

      public void unload()
      Unloads developer's world and teleports all players in it to lobby.
    • unload

      public 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()
      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

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

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

      public 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(DevPlatform platform, 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

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

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

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

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

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

      public void updateContainers()
    • updateSigns

      public void updateSigns()
    • isLoaded

      public boolean isLoaded()
    • getOpenedMenu

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

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

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

      public org.bukkit.Material getContainerMaterial()
    • getSignMaterial

      public 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(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

      public 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.
    • 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

      public Planet getPlanet()