Class Planet
Planet
This class represents a Planet, the individual place for players that consists of two worlds: for building and for developing. It has owner, world size, sharing, world mode, limits, flags, players data, variables and states.Planet files are stored in ./planets/planetID folder.
- Since:
- 1.0
- Version:
- 6.0
- Author:
- McChicken Studio
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectPlayer(@NotNull org.bukkit.entity.Player player) Connects player to the planet.voidconnectPlayer(@NotNull org.bukkit.entity.Player player, boolean hidePlayer) Connects player to the planet.voidconnectToDevPlanet(org.bukkit.entity.Player player) Connects player to developer's world.voidconnectToDevPlanet(org.bukkit.entity.Player player, boolean hidePlayer) Connects player to developer's planet.voidconnectToDevPlanet(org.bukkit.entity.Player player, double x, double y, double z) Connects player to developer's world, teleports next to block on specified coordinates.@NotNull net.kyori.adventure.audience.AudienceReturns audience of world, that contains players in world and players from developer's world.longReturns creation time of world.Returns developer's planet of world, that has coding platforms to create a code.Returns holder of planet's experiments.byteReturns byte value of flag.@NotNull GroupgetGroup()Return group of planet's owner.intgetId()Returns numeric ID of world.Returns information of planet, that stores display name, description, custom ID and icon.longReturns last activity time of world.Returns holder of planet's limits and modifiers.getMode()Returns current mode of planet.intReturns total players count in world.getOwner()Returns owner's nickname of planet.Returns owner's group of planet.List<org.bukkit.entity.Player> Returns list of all players in world.@NotNull Planet.SharingReturns sharing mode of planet.Returns territory of planet, that contains planet's world, environment, flags, boss bars, scoreboards, code script and other temporary values.Returns holder of global and saved variables in planet.org.bukkit.WorldgetWorld()Returns world if planet is loaded, null - planet is unloaded.Returns world's name on server in the format:./planets/planetIDReturns players registry of planet, that stores builders, developers, whitelisted and banned players.booleanChecks whether world is in a state of changing owner.booleanReturns whether world is corrupted (doesn't have owner information) or not.booleanisDebug()Checks whether world's coding is in debug mode.booleanisLoaded()Checks if loaded main world of planet.booleanChecks whether the owner's nickname same as specified.booleanisOwner(org.bukkit.entity.Player player) Checks whether the player is owner of planet.voidloadInfo()Loads information of planet: owner, owner's group, mode, sharing, corrupted state, creation time, last activity time.voidsetChangingOwner(boolean changingOwner) Sets state of changing world's owner.voidsetCreationTime(long creationTime) Sets creation unix time of world.voidsetDebug(boolean debug) Sets debug mode for coding in world.voidsetFlagValue(PlanetFlags.PlanetFlag flag, byte value) Sets byte value of flag.voidsetLastActivityTime(long activityTime) Sets last activity unix time in world.voidsetMode(@NotNull Planet.Mode mode) Changes planet's mode to Play or Build.voidsetMode(@NotNull Planet.Mode mode, boolean ignoreEvents) Changes planet's mode to Play or Build.voidSets new owner of world.voidsetSharing(@NotNull Planet.Sharing sharing) Sharing is ability for players to connect to the world.
-
Constructor Details
-
Planet
public Planet(int id) Loads a planet with world name.
-
-
Method Details
-
getInformation
Returns information of planet, that stores display name, description, custom ID and icon.- Returns:
- planet's info.
-
getWorldPlayers
Returns players registry of planet, that stores builders, developers, whitelisted and banned players.- Returns:
- planet's registry of players.
-
isDebug
public boolean isDebug()Checks whether world's coding is in debug mode.- Returns:
- true - in debug mode, false - not.
-
setDebug
public void setDebug(boolean debug) Sets debug mode for coding in world.- Parameters:
debug- true - enabled, false - disabled.
-
getVariables
Returns holder of global and saved variables in planet.- Returns:
- planet's variables.
-
isCorrupted
public boolean isCorrupted()Returns whether world is corrupted (doesn't have owner information) or not.- Returns:
- true - corrupted, false - not.
-
getLimits
Returns holder of planet's limits and modifiers.- Returns:
- planet's limits.
-
getExperiments
Returns holder of planet's experiments.- Returns:
- planet's experiments.
-
getGroup
Return group of planet's owner.Useful to get limits and modifiers.
- Returns:
- group of owner.
-
getSharing
Returns sharing mode of planet.Public - all players can connect to the world.
Private - only world owner can connect to the world.
Closed - no one can connect to the world, deleting mode.
- Returns:
- sharing mode.
-
setSharing
Sharing is ability for players to connect to the world.Public - all players can connect to the world.
Private - only world owner can connect to the world.
Closed - no one can connect to the world, deleting mode.
- Parameters:
sharing- sharing mode.
-
getWorldName
Returns world's name on server in the format:./planets/planetIDCan be used for getting world from server.
- Returns:
- world's name on server.
-
getId
public int getId()Returns numeric ID of world.- Returns:
- numeric ID.
-
getDevPlanet
Returns developer's planet of world, that has coding platforms to create a code.- Returns:
- developer's planet.
-
isChangingOwner
public boolean isChangingOwner()Checks whether world is in a state of changing owner.- Returns:
- true - owner requested to transfer world, false - not.
-
setChangingOwner
public void setChangingOwner(boolean changingOwner) Sets state of changing world's owner.- Parameters:
changingOwner- true - owner requested to transfer world, false - not.
-
isOwner
public boolean isOwner(org.bukkit.entity.Player player) Checks whether the player is owner of planet.- Parameters:
player- player to check.- Returns:
- true - is owner, false - not owner.
-
isOwner
Checks whether the owner's nickname same as specified.Ignores caps consideration.
- Parameters:
nickname- name to check.- Returns:
- true - is owner, false - not owner.
-
getTerritory
Returns territory of planet, that contains planet's world, environment, flags, boss bars, scoreboards, code script and other temporary values.- Returns:
- planet's territory.
-
isLoaded
public boolean isLoaded()Checks if loaded main world of planet.- Returns:
- true - if loaded, false - unloaded.
-
getWorld
public org.bukkit.World getWorld()Returns world if planet is loaded, null - planet is unloaded.- Returns:
- world, or null.
-
getMode
-
setMode
Changes planet's mode to Play or Build.In the Build mode players cannot get damaged, they only can look at builders which are creating a map.
In the Play mode code script will work, player damaging is enabled.
- Parameters:
mode- Mode to set.
-
getOnline
public int getOnline()Returns total players count in world.Includes all players from build world and developer's world.
- Returns:
- online of planet.
-
getCreationTime
public long getCreationTime()Returns creation time of world.If value is unknown (0), will return
1670573410000L(publication of OpenCreative+).- Returns:
- unix time, when world was created.
-
setCreationTime
public void setCreationTime(long creationTime) Sets creation unix time of world.- Parameters:
creationTime- time, when world was created.
-
getLastActivityTime
public long getLastActivityTime()Returns last activity time of world.If value is unknown (0), will return
1670573410000L(publication of OpenCreative+).- Returns:
- unix last time, when someone joined the world.
-
setLastActivityTime
public void setLastActivityTime(long activityTime) Sets last activity unix time in world.- Parameters:
activityTime- last activity time.
-
getPlayers
Returns list of all players in world.Includes all players from build world and developer's world.
- Returns:
- list of all online players in world.
-
getAudience
@NotNull public @NotNull net.kyori.adventure.audience.Audience getAudience()Returns audience of world, that contains players in world and players from developer's world.- Returns:
- audience of world.
-
getOwner
-
setOwner
-
getOwnerGroup
-
setMode
Changes planet's mode to Play or Build.In the Build mode players cannot get damaged, they only can look at builders which are creating a map.
In the Play mode code script will work, player damaging is enabled.
- Parameters:
mode- Mode to set.ignoreEvents- Don't call world start, player join or player quit events on mode change.
-
loadInfo
public void loadInfo()Loads information of planet: owner, owner's group, mode, sharing, corrupted state, creation time, last activity time. -
getFlagValue
Returns byte value of flag.- Parameters:
flag- flag to get value.- Returns:
- value of flag.
-
setFlagValue
Sets byte value of flag.- Parameters:
flag- flag to set value.value- new value.
-
connectPlayer
public void connectPlayer(@NotNull @NotNull org.bukkit.entity.Player player) Connects player to the planet.May not connect player to the planet if some conditions are not met.
For example: stability is not good, world is private, player is banned in world, error while loading spawn location.
- Parameters:
player- player to connect.
-
connectPlayer
public void connectPlayer(@NotNull @NotNull org.bukkit.entity.Player player, boolean hidePlayer) Connects player to the planet.May not connect player to the planet if some conditions are not met.
For example: stability is not good, world is private, player is banned in world, error while loading spawn location.
- Parameters:
player- player to connect.hidePlayer- hide player's join message, and make him in spectator mode or not.
-
connectToDevPlanet
public void connectToDevPlanet(org.bukkit.entity.Player player) Connects player to developer's world.- Parameters:
player- player to connect.
-
connectToDevPlanet
public void connectToDevPlanet(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.
-
connectToDevPlanet
public void connectToDevPlanet(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.
-