Class CosmeticUnlockEvent
java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.cosmetics.CosmeticUnlockEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Called before cosmetics are unlocked for a player through the API: granted by an addon with
CosmeticsService#grant or #grantTimed, or bought with
CosmeticsService#purchase or in the cosmetics menu. The player may be offline.
Cancelling leaves the player's cosmetics as they are; a cancelled purchase takes no payment.
Grants made by administrators' commands do not fire this event.
CosmeticOwnershipChangeEvent reports every change after it was stored.
Main thread; only fired while a listener is registered.
- Since:
- 1.11.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow the cosmetics are unlocked.Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionCosmeticUnlockEvent(@NotNull UUID playerId, @NotNull CosmeticTypeKey type, @NotNull Collection<String> cosmeticIds, @NotNull CosmeticUnlockEvent.Cause cause, @Nullable Duration duration, @Nullable Double price) -
Method Summary
Modifier and TypeMethodDescription@NotNull CosmeticUnlockEvent.CausegetCause()How they are unlocked.The cosmetics unlocked.How long a timed grant lasts; empty for a permanent unlock.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.@NotNull UUIDThe player gaining them.@NotNull OptionalDoublegetPrice()What a purchase costs; empty for a grant.@NotNull CosmeticTypeKeygetType()The type they belong to.booleanvoidsetCancelled(boolean cancelled) Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
CosmeticUnlockEvent
public CosmeticUnlockEvent(@NotNull @NotNull UUID playerId, @NotNull @NotNull CosmeticTypeKey type, @NotNull @NotNull Collection<String> cosmeticIds, @NotNull @NotNull CosmeticUnlockEvent.Cause cause, @Nullable @Nullable Duration duration, @Nullable @Nullable Double price) - Parameters:
duration- how long a timed grant lasts, or null for a permanent oneprice- what a purchase costs, or null for a grant
-
-
Method Details
-
getPlayerId
The player gaining them. -
getType
The type they belong to. -
getCosmeticIds
The cosmetics unlocked. -
getCause
How they are unlocked. -
getDuration
How long a timed grant lasts; empty for a permanent unlock. -
getPrice
What a purchase costs; empty for a grant. -
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()
-