Package net.kyori.adventure.resource
Interface ResourcePackCallback
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A callback for a resource pack application operation.
- Since:
- 4.15.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResourcePackCallback
noOp()
Create a pack callback that performs no operation.static @NotNull ResourcePackCallback
onTerminal
(@NotNull BiConsumer<UUID, Audience> success, @NotNull BiConsumer<UUID, Audience> failure) Create a pack callback that will only execute the provided functions when the pack application has completed, discarding all intermediate events.void
packEventReceived
(@NotNull UUID uuid, @NotNull ResourcePackStatus status, @NotNull Audience audience) Called when a pack event has been received.
-
Method Details
-
noOp
Create a pack callback that performs no operation.Multiple calls to this method are guaranteed to return callback functions with equal identity.
- Returns:
- the no-op callback
- Since:
- 4.15.0
-
onTerminal
@NotNull static @NotNull ResourcePackCallback onTerminal(@NotNull @NotNull BiConsumer<UUID, Audience> success, @NotNull @NotNull BiConsumer<UUID, Audience> failure) Create a pack callback that will only execute the provided functions when the pack application has completed, discarding all intermediate events.- Parameters:
success
- the success callbackfailure
- the failure callback- Returns:
- the created callback
- Since:
- 4.15.0
-
packEventReceived
void packEventReceived(@NotNull @NotNull UUID uuid, @NotNull @NotNull ResourcePackStatus status, @NotNull @NotNull Audience audience) Called when a pack event has been received.If the pack apply action was executed on a group audience,
audience
will referer to the individual member audiences the action is executed on. Forwarding audiences may wrap callbacks to ensure they receive the appropriate wrapped audience.- Parameters:
uuid
- the uuid of the pack that has been applied.status
- the current pack statusaudience
- the audience the pack is being applied to- Since:
- 4.15.0
-