Class CosmeticEquipEvent

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

public final class CosmeticEquipEvent extends ZentrixEvent implements org.bukkit.event.Cancellable
Called before a player's own choice of cosmetic is saved, in any type, built-in or an addon's: equipping one, or unequipping to go back to the type's default. Made in the cosmetics menu or by an addon through CosmeticsService#equip and #unequip.

For built-in categories CosmeticSelectEvent is called first; cancelling either keeps the current choice. Choices made through CosmeticsService#select do not fire this event. Cancelling from the menu plays its error sound; telling the player why is up to the listener.

Main thread; only fired while a listener is registered.

Since:
1.11.0
  • Constructor Details

    • CosmeticEquipEvent

      public CosmeticEquipEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull CosmeticTypeKey type, @Nullable @Nullable String cosmeticId, @Nullable @Nullable String previousId, @NotNull @NotNull CosmeticActionOrigin origin)
  • Method Details

    • getPlayer

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

      @NotNull public @NotNull CosmeticTypeKey getType()
      The type they choose in.
    • getCosmeticId

      @NotNull public @NotNull Optional<String> getCosmeticId()
      The cosmetic equipped; empty when they unequip, going back to the type's default.
    • isUnequip

      public boolean isUnequip()
      Whether the player unequips, going back to the type's default.
    • getPreviousId

      @NotNull public @NotNull Optional<String> getPreviousId()
      Their stored choice until now; empty when they had none.
    • getOrigin

      @NotNull public @NotNull CosmeticActionOrigin getOrigin()
      Where the choice was made.
    • 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()