Class CosmeticDefinition

java.lang.Object
dev.itsharshxd.zentrix.api.cosmetics.CosmeticDefinition

public final class CosmeticDefinition extends Object
One cosmetic of an addon's type, as its handler lists it. Immutable; build one with builder(String).

Who may use it:

  • a player who owns it, granted or bought;
  • a player who holds its permission, when it has one;
  • everyone, when it is unlocked by default.
One with a price can be bought with Zentrix's currency by players who cannot use it yet.

 CosmeticDefinition crown = CosmeticDefinition.builder("crown")
     .name("&6Golden Crown")
     .icon(new ItemStack(Material.GOLDEN_HELMET))
     .lore(List.of("&7Fit for a champion."))
     .rarity("&6Legendary")
     .price(2500)
     .build();
 
Since:
1.11.0
  • Method Details

    • builder

      @NotNull public static @NotNull CosmeticDefinition.Builder builder(@NotNull @NotNull String id)
      Starts a cosmetic.
      Parameters:
      id - the stable ID ownership is stored under: a-z, 0-9, _ and -
    • getId

      @NotNull public @NotNull String getId()
      The stable ID ownership is stored under.
    • getName

      @NotNull public @NotNull String getName()
      The display name, in Zentrix's colour format.
    • getIcon

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getIcon()
      A copy of the icon menus show it with.
    • getLore

      @NotNull public @NotNull List<String> getLore()
      The description lines, in Zentrix's colour format.
    • getRarity

      @NotNull public @NotNull Optional<String> getRarity()
      The rarity label, in Zentrix's colour format, such as &6Legendary.
    • getPermission

      @NotNull public @NotNull Optional<String> getPermission()
      The permission that unlocks it without owning it.
    • getPrice

      @NotNull public @NotNull OptionalDouble getPrice()
      What it costs in Zentrix's currency; empty when it is not for sale.
    • isUnlockedByDefault

      public boolean isUnlockedByDefault()
      Whether every player may use it without owning it.