Class PlanetInfo
java.lang.Object
ua.mcchickenstudio.opencreative.planets.PlanetInfo
PlanetInfo
This class represents an information of planet. It contains display name, description, custom ID, category, reputation and icon of planet.This information will be displayed in worlds browser or in advertisement messages.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.text.ComponentReturns text component of description, that can be used in item stacks or texts.net.kyori.adventure.text.ComponentReturns text component of display name, that can be used in item stacks or texts.intReturns inaccurate amount of players in world, that changes with entering or leaving the world, doesn't check real amount of world.Returns category of planet.Returns text custom ID of planet, that can be used with /join.Returns description, that stores in world's settings.Returns display name, that stores in world's settings.org.bukkit.inventory.ItemStackgetIcon()Returns icon of planet.@NotNull PlanetReturns assigned planet.intReturns rating of planet.intReturns count of unique visitors.booleanChecks if world can be used as template in worlds generation menu.voidLoads information from world's settings.voidRemoves custom ID from world.voidsetCategory(PlanetInfo.Category category) Sets category of planet, that will be displayed in worlds browser menu.voidsetCustomID(@NotNull String customID) Sets new text custom ID, that can be used to join world with short /join command.voidsetDescription(String description) Sets new description of planet, that will be displayed in worlds browser menu.voidsetDisplayName(String name) Sets new display name of planet, that will be displayed in worlds browser menu and advertisements.voidsetDownloadable(boolean downloadable) Sets can be world used as template to generate a new world.voidsetIcon(org.bukkit.inventory.ItemStack itemStack) Sets new item stack as planet's icon.voidsetPlanetReputation(int reputation) Sets rating of planet.voidsetUniques(int uniques) Sets count of unique visitors.voidUpdates icon with current planet's information.voidUpdates icon in asynchronous task.
-
Constructor Details
-
PlanetInfo
-
-
Method Details
-
loadInformation
public void loadInformation()Loads information from world's settings. -
updateIconAsync
public void updateIconAsync()Updates icon in asynchronous task. Used to not load the main thread. -
updateIcon
public void updateIcon()Updates icon with current planet's information. -
resetCustomID
public void resetCustomID()Removes custom ID from world. -
displayName
public net.kyori.adventure.text.Component displayName()Returns text component of display name, that can be used in item stacks or texts.- Returns:
- display name of planet.
-
description
public net.kyori.adventure.text.Component description()Returns text component of description, that can be used in item stacks or texts.- Returns:
- description of planet.
-
getDisplayName
Returns display name, that stores in world's settings.- Returns:
- display name of planet.
-
setDisplayName
Sets new display name of planet, that will be displayed in worlds browser menu and advertisements.- Parameters:
name- new display name.
-
getDescription
Returns description, that stores in world's settings.- Returns:
- description of planet.
-
setDescription
Sets new description of planet, that will be displayed in worlds browser menu.- Parameters:
description- new description.
-
getCategory
-
setCategory
Sets category of planet, that will be displayed in worlds browser menu.- Parameters:
category- new category.
-
getCustomID
Returns text custom ID of planet, that can be used with /join.- Returns:
- custom ID of planet.
-
setCustomID
Sets new text custom ID, that can be used to join world with short /join command.- Parameters:
customID- new custom ID.
-
getIcon
public org.bukkit.inventory.ItemStack getIcon()Returns icon of planet. If planet is closed, it will have type of barrier.- Returns:
- icon of planet
-
setIcon
public void setIcon(org.bukkit.inventory.ItemStack itemStack) Sets new item stack as planet's icon. Name, lore and enchantments will be removed from item.- Parameters:
itemStack- new icon.
-
getUniques
public int getUniques()Returns count of unique visitors.- Returns:
- count of uniques.
-
setUniques
public void setUniques(int uniques) Sets count of unique visitors.- Parameters:
uniques- new count.
-
getReputation
public int getReputation()Returns rating of planet. It's calculated by subtracting likes count by count of dislikes. It's displayed in worlds browser menu.- Returns:
- reputation of planet.
-
setPlanetReputation
public void setPlanetReputation(int reputation) Sets rating of planet. It's displayed in worlds browser menu.- Parameters:
reputation- new reputation.
-
isDownloadable
public boolean isDownloadable()Checks if world can be used as template in worlds generation menu.- Returns:
- true - can be used as template, false - not.
-
setDownloadable
public void setDownloadable(boolean downloadable) Sets can be world used as template to generate a new world.- Parameters:
downloadable- true - can be used, false - not.
-
getAsyncOnline
public int getAsyncOnline()Returns inaccurate amount of players in world, that changes with entering or leaving the world, doesn't check real amount of world.Useful to avoid lags by checking all world players.
- Returns:
- inaccurate amount of players in world.
- See Also:
-
getPlanet
-