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(DevPlatform platform, 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) 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.Set<org.bukkit.Material> Set<org.bukkit.Material> 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.org.bukkit.Materialstatic org.bukkit.MaterialReturns default action block material, used for creating new coding platforms.static org.bukkit.MaterialReturns default event block material, used for creating new coding platforms.static org.bukkit.MaterialReturns default floor block material, used for creating new coding platforms.@NotNull DevPlatformerSet<org.bukkit.Material> Set<org.bukkit.Material> @NotNull Set<org.bukkit.Location> getMarkedExecutors(@NotNull org.bukkit.entity.Player player) getOpenedMenu(org.bukkit.Location location) List<org.bukkit.Location> getPlacedExecutors(ExecutorCategory category) List<org.bukkit.Location> List<org.bukkit.Location> @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.org.bukkit.Materialorg.bukkit.WorldgetWorld()@NotNull StringbooleanReturns whether code was changed after last parsing and saving.booleanChecks whether code is currently being saved to file or not.booleanbooleanisLoaded()booleanbooleanvoidLoads 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(org.bukkit.Location location, Layout menu) booleansetContainerMaterial(org.bukkit.Material containerMaterial) voidsetCurrentlySavingCode(boolean currentlySavingCode) Sets the state of saving code.voidsetDropItems(boolean dropItems) voidsetNightVision(boolean nightVision) voidsetPlatformerID(String platformer) voidsetSaveLocation(boolean saveLocation) booleansetSignMaterial(org.bukkit.Material signMaterial) voidSetups developer's world, changes spawn location, sets game rules and world border.voidunload()Unloads developer's world and teleports all players in it to lobby.voidunload(boolean asyncSave) Unloads developer's world and teleports all players in it to lobby.voidunregisterOpenedMenu(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
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
-
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
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() -
isLoaded
public boolean isLoaded() -
getOpenedMenu
-
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
-
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.
-
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
-