Class CosmeticSelectEvent

java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.cosmetics.CosmeticSelectEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public final class CosmeticSelectEvent extends ZentrixEvent implements org.bukkit.event.Cancellable
Called before a player's own choice of cosmetic in the cosmetics menu is saved, and, since 1.11.0, one an addon makes for them through CosmeticsService#equip or #unequip. Only for built-in categories; CosmeticEquipEvent, called next, covers every type.

Cancelling keeps their current choice; the menu plays its error sound, and telling the player why is up to the listener. Choices made through CosmeticsService#select do not fire this event.

Main thread; only fired while a listener is registered.

Since:
1.8.0
  • Constructor Details

    • CosmeticSelectEvent

      public CosmeticSelectEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull CosmeticCategory category, @Nullable @Nullable String cosmeticId)
  • Method Details

    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      The player choosing.
    • getCategory

      @NotNull public @NotNull CosmeticCategory getCategory()
      The category they choose in.
    • getCosmeticId

      @NotNull public @NotNull Optional<String> getCosmeticId()
      The cosmetic chosen; empty when they chose the server's default.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: ZentrixEvent
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixEvent
      Returns:
      The handler list
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()