Class PlanetInfo

java.lang.Object
ua.mcchickenstudio.opencreative.planets.PlanetInfo

public class PlanetInfo extends Object

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
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.kyori.adventure.text.Component
    Returns text component of description, that can be used in item stacks or texts.
    net.kyori.adventure.text.Component
    Returns text component of display name, that can be used in item stacks or texts.
    int
    Returns 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.ItemStack
    Returns icon of planet.
    @NotNull Planet
    Returns assigned planet.
    int
    Returns rating of planet.
    int
    Returns count of unique visitors.
    boolean
    Checks if world can be used as template in worlds generation menu.
    void
    Loads information from world's settings.
    void
    Removes custom ID from world.
    void
    Sets category of planet, that will be displayed in worlds browser menu.
    void
    setCustomID(@NotNull String customID)
    Sets new text custom ID, that can be used to join world with short /join command.
    void
    setDescription(String description)
    Sets new description of planet, that will be displayed in worlds browser menu.
    void
    Sets new display name of planet, that will be displayed in worlds browser menu and advertisements.
    void
    setDownloadable(boolean downloadable)
    Sets can be world used as template to generate a new world.
    void
    setIcon(org.bukkit.inventory.ItemStack itemStack)
    Sets new item stack as planet's icon.
    void
    setPlanetReputation(int reputation)
    Sets rating of planet.
    void
    setUniques(int uniques)
    Sets count of unique visitors.
    void
    Updates icon with current planet's information.
    void
    Updates icon in asynchronous task.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlanetInfo

      public PlanetInfo(Planet planet)
  • 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

      public String getDisplayName()
      Returns display name, that stores in world's settings.
      Returns:
      display name of planet.
    • setDisplayName

      public void setDisplayName(String name)
      Sets new display name of planet, that will be displayed in worlds browser menu and advertisements.
      Parameters:
      name - new display name.
    • getDescription

      public String getDescription()
      Returns description, that stores in world's settings.
      Returns:
      description of planet.
    • setDescription

      public void setDescription(String description)
      Sets new description of planet, that will be displayed in worlds browser menu.
      Parameters:
      description - new description.
    • getCategory

      public PlanetInfo.Category getCategory()
      Returns category of planet.
      Returns:
      category of planet.
    • setCategory

      public void setCategory(PlanetInfo.Category category)
      Sets category of planet, that will be displayed in worlds browser menu.
      Parameters:
      category - new category.
    • getCustomID

      public String getCustomID()
      Returns text custom ID of planet, that can be used with /join.
      Returns:
      custom ID of planet.
    • setCustomID

      public void setCustomID(@NotNull @NotNull String customID)
      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

      @NotNull public @NotNull Planet getPlanet()
      Returns assigned planet.
      Returns:
      assigned planet.