Class CosmeticTypeDefinition

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

public final class CosmeticTypeDefinition extends Object
How an addon's cosmetic type shows in /cosmetics and when it triggers. Immutable; build one with builder(String) and register it with CosmeticsService.registerType(org.bukkit.plugin.Plugin, dev.itsharshxd.zentrix.api.cosmetics.CosmeticTypeDefinition, dev.itsharshxd.zentrix.api.cosmetics.CosmeticHandler).

 CosmeticTypeDefinition hats = CosmeticTypeDefinition.builder("hats")
     .name("&eHats")
     .description(List.of("&fChoose the hat you wear", "&fin every match."))
     .icon(new ItemStack(Material.LEATHER_HELMET))
     .triggers(CosmeticMoment.GAME_START, CosmeticMoment.GAME_LEAVE)
     .build();
 
Since:
1.11.0
  • Method Details

    • builder

      @NotNull public static @NotNull CosmeticTypeDefinition.Builder builder(@NotNull @NotNull String key)
      Starts a type.
      Parameters:
      key - the type within the registering plugin's namespace, such as hats: a-z, 0-9, _ and -. Ownership is stored under it, so keep it stable.
    • getKey

      @NotNull public @NotNull String getKey()
      The type within the registering plugin's namespace.
    • getName

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

      @NotNull public @NotNull List<String> getDescription()
      The description lines of its tile, in Zentrix's colour format.
    • getIcon

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getIcon()
      A copy of its tile's icon.
    • getDefaultId

      @NotNull public @NotNull Optional<String> getDefaultId()
      The cosmetic used by players who chose none; empty when they have none.
    • getTriggers

      @NotNull public @NotNull Set<CosmeticMoment> getTriggers()
      The moments the type triggers at.
    • isShowLocked

      public boolean isShowLocked()
      Whether /cosmetics also lists the cosmetics a player can neither use nor buy.
    • hasPreviews

      public boolean hasPreviews()
      Whether its handler shows previews, so /cosmetics offers right-click to preview.