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.
@FunctionalInterface public interface ResourcePackCallback
A callback for a resource pack application operation.- Since:
- 4.15.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static @NotNull ResourcePackCallback
noOp()
Create a pack callback that performs no operation.static @NotNull ResourcePackCallback
onTerminal(@NotNull java.util.function.BiConsumer<java.util.UUID,Audience> success, @NotNull java.util.function.BiConsumer<java.util.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 java.util.UUID uuid, @NotNull ResourcePackStatus status, @NotNull Audience audience)
Called when a pack event has been received.
-
-
-
Method Detail
-
noOp
@NotNull static @NotNull ResourcePackCallback 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 java.util.function.BiConsumer<java.util.UUID,Audience> success, @NotNull @NotNull java.util.function.BiConsumer<java.util.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 java.util.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
-
-