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
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionCosmeticEquipEvent(@NotNull org.bukkit.entity.Player player, @NotNull CosmeticTypeKey type, @Nullable String cosmeticId, @Nullable String previousId, @NotNull CosmeticActionOrigin origin) -
Method Summary
Modifier and TypeMethodDescriptionThe cosmetic equipped; empty when they unequip, going back to the type's default.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.@NotNull CosmeticActionOriginWhere the choice was made.@NotNull org.bukkit.entity.PlayerThe player choosing.Their stored choice until now; empty when they had none.@NotNull CosmeticTypeKeygetType()The type they choose in.booleanbooleanWhether the player unequips, going back to the type's default.voidsetCancelled(boolean cancelled) Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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
The type they choose in. -
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
Their stored choice until now; empty when they had none. -
getOrigin
Where the choice was made. -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:ZentrixEventGets the handler list for this event.- Overrides:
getHandlersin classZentrixEvent- Returns:
- The handler list
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-