Class DevPlanet
java.lang.Object
ua.mcchickenstudio.opencreative.planets.DevPlanet
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangedColumn(@NotNull org.bukkit.Location executorLocation) Adds coding line, that will be parsed on partially code parsing (/play).voidaddInsideCodeColumnChange(@NotNull org.bukkit.Location location) Adds coding line, that will be parsed on partially code parsing (/play) by getting begin location.booleanclaimPlatform(@NotNull DevPlatform platform, @NotNull org.bukkit.entity.Player player) Claims new platform and teleports player to it.voidClears set of changed coding lines, so they will be not parsed.voidclearMarkedExecutors(@NotNull org.bukkit.Location location) Removes marked executor for all players, who selected it with manipulator item.voidclearMarkedExecutors(@NotNull org.bukkit.entity.Player player) voidconnectPlayer(@NotNull org.bukkit.entity.Player player) Connects player to developer's world.voidconnectPlayer(@NotNull org.bukkit.entity.Player player, boolean hidePlayer) Connects player to developer's planet.voidconnectPlayer(@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.booleancreatePlatform(int platformX, int platformZ) Creates a coding platform with specified X and Z of platform.voidChanges world border for all players inside developer world, used when some player joins the developer world.booleanexists()Checks whether developer planet was generated before.@NotNull Set<org.bukkit.Material> @NotNull Set<org.bukkit.Material> @NotNull Set<org.bukkit.Material> @NotNull Set<org.bukkit.Location> Returns immutable set of executor locations for changed coding lines.@Nullable org.bukkit.LocationgetCodingLineBeginLocation(@NotNull org.bukkit.Location location) Returns executor location by location.@NotNull org.bukkit.Materialstatic @NotNull org.bukkit.MaterialReturns default action block material, used for creating new coding platforms.static @NotNull org.bukkit.MaterialReturns default event block material, used for creating new coding platforms.static @NotNull org.bukkit.MaterialReturns default floor block material, used for creating new coding platforms.@NotNull DevPlatformer@NotNull Set<org.bukkit.Material> @NotNull Set<org.bukkit.Material> @NotNull Set<org.bukkit.Location> getMarkedExecutors(@NotNull org.bukkit.entity.Player player) @Nullable LayoutgetOpenedMenu(@NotNull org.bukkit.Location location) @NotNull List<org.bukkit.Location> getPlacedExecutors(ExecutorCategory category) @NotNull List<org.bukkit.Location> @NotNull List<org.bukkit.Location> @NotNull Planet@Nullable DevPlatformgetPlatformInLocation(@NotNull org.bukkit.Location location) Returns coding platform by location.@NotNull List<DevPlatform> Returns list of existing coding platforms, that can be used to place coding blocks.@NotNull org.bukkit.Materialorg.bukkit.WorldgetWorld()@NotNull String@Nullable UUIDReturns unique ID of loaded developer world.booleanReturns whether code was changed after last parsing and saving.booleanChecks whether code is currently being saved to file or not.booleanbooleanisLoaded()Checks whether developer world is loaded.booleanboolean@NotNull CompletableFuture<org.bukkit.World> load()Loads developer's world and setups it.voidmarkExecutorAsSelected(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location location) Adds executor to marked list for player, when they click it with manipulator item.voidregisterOpenedMenu(@NotNull org.bukkit.Location location, @NotNull Layout menu) booleansetContainerMaterial(org.bukkit.Material containerMaterial) voidsetCurrentlySavingCode(boolean currentlySavingCode) Sets the state of saving code.voidsetDropItems(boolean dropItems) voidsetNightVision(boolean nightVision) voidsetPlatformerID(@NotNull String platformer) voidsetSaveLocation(boolean saveLocation) booleansetSignMaterial(org.bukkit.Material signMaterial) voidsetupWorld(@NotNull org.bukkit.World world) Setups developer's world, changes spawn location, sets game rules and world border.voidSets a unique ID of loaded developer world.@NotNull CompletableFuture<Void> unload()Unloads developer's world and teleports all players in it to lobby.@NotNull CompletableFuture<Void> unload(boolean asyncSave) Unloads developer's world and teleports all players in it to lobby.voidunregisterOpenedMenu(@NotNull org.bukkit.Location location) voidunselectMarkedExecutor(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location location) Removes marked executor for player, who selected it with manipulator item.voidvoid
-
Constructor Details
-
DevPlanet
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
Loads developer's world and setups it. -
unload
Unloads developer's world and teleports all players in it to lobby. -
unload
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
-
getEventsBlocks
-
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
-
getAllowedBlocks
-
getPlacedExecutors
-
getPlacedFunctions
-
getPlacedMethods
-
updateContainers
public void updateContainers() -
updateSigns
public void updateSigns() -
getWorldUUID
Returns unique ID of loaded developer world.- Returns:
- uuid of world, null - if not loaded.
-
setWorld
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
-
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
-
setContainerMaterial
public boolean setContainerMaterial(org.bukkit.Material containerMaterial) -
setSignMaterial
public boolean setSignMaterial(org.bukkit.Material signMaterial) -
getWorldName
-
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
-
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
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
-