Package net.kyori.adventure.text.event
Interface ClickCallback<T extends Audience>
- 
- Type Parameters:
- T- audience type
 - 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 ClickCallback<T extends Audience>A handler for callback click events.- Since:
- 4.13.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceClickCallback.OptionsOptions to configure how a callback can be executed.static interfaceClickCallback.ProviderA provider for actually producing click callbacks.
 - 
Field SummaryFields Modifier and Type Field Description static java.time.DurationDEFAULT_LIFETIMEThe default lifetime of a callback after creating it, 12 hours.static intUNLIMITED_USESIndicate that a callback should have unlimited uses.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaccept(T audience)Perform an action for this event.default @NotNull ClickCallback<T>filter(@NotNull java.util.function.Predicate<T> filter)Filter audiences that receive this click callback.default @NotNull ClickCallback<T>filter(@NotNull java.util.function.Predicate<T> filter, @Nullable java.util.function.Consumer<? super Audience> otherwise)Filter audiences that receive this click callback.default @NotNull ClickCallback<T>requiringPermission(@NotNull java.lang.String permission)Require that audiences receiving this callback have a certain permission.default @NotNull ClickCallback<T>requiringPermission(@NotNull java.lang.String permission, @Nullable java.util.function.Consumer<? super Audience> otherwise)Require that audiences receiving this callback have a certain permission.static <W extends Audience,N extends W>
 @NotNull ClickCallback<W>widen(@NotNull ClickCallback<N> original, @NotNull java.lang.Class<N> type)Adjust this callback to accept any audience, and perform the appropriate filtering.static <W extends Audience,N extends W>
 @NotNull ClickCallback<W>widen(@NotNull ClickCallback<N> original, @NotNull java.lang.Class<N> type, @Nullable java.util.function.Consumer<? super Audience> otherwise)Adjust this callback to accept any audience, and perform the appropriate filtering.
 
- 
- 
- 
Field Detail- 
DEFAULT_LIFETIMEstatic final java.time.Duration DEFAULT_LIFETIME The default lifetime of a callback after creating it, 12 hours.- Since:
- 4.13.0
 
 - 
UNLIMITED_USESstatic final int UNLIMITED_USES Indicate that a callback should have unlimited uses.- Since:
- 4.13.0
- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
widen@CheckReturnValue @Contract(pure=true) @NotNull static <W extends Audience,N extends W> @NotNull ClickCallback<W> widen(@NotNull @NotNull ClickCallback<N> original, @NotNull @NotNull java.lang.Class<N> type, @Nullable @Nullable java.util.function.Consumer<? super Audience> otherwise) Adjust this callback to accept any audience, and perform the appropriate filtering.- Type Parameters:
- W- the wider type
- N- the narrower type
- Parameters:
- original- the original callback of a narrower audience type
- type- the audience type to accept
- otherwise- the action to perform on the audience if it is not of the appropriate type
- Returns:
- a new callback
- Since:
- 4.13.0
 
 - 
widen@CheckReturnValue @Contract(pure=true) @NotNull static <W extends Audience,N extends W> @NotNull ClickCallback<W> widen(@NotNull @NotNull ClickCallback<N> original, @NotNull @NotNull java.lang.Class<N> type) Adjust this callback to accept any audience, and perform the appropriate filtering.No message will be sent if the audience is not of the appropriate type. - Type Parameters:
- W- the wider type
- N- the narrower type
- Parameters:
- original- the original callback of a narrower audience type
- type- the audience type to accept
- Returns:
- a new callback
- Since:
- 4.13.0
 
 - 
acceptvoid accept(@NotNull T audience)Perform an action for this event.- Parameters:
- audience- the single-user audience who is attempting to execute this callback function.
- Since:
- 4.13.0
 
 - 
filter@CheckReturnValue @Contract(pure=true) @NotNull default @NotNull ClickCallback<T> filter(@NotNull @NotNull java.util.function.Predicate<T> filter) Filter audiences that receive this click callback.Actions from audiences that do not match this predicate will be silently ignored. - Parameters:
- filter- the filter to test audiences with
- Returns:
- a filtered callback action
- Since:
- 4.13.0
 
 - 
filter@CheckReturnValue @Contract(pure=true) @NotNull default @NotNull ClickCallback<T> filter(@NotNull @NotNull java.util.function.Predicate<T> filter, @Nullable @Nullable java.util.function.Consumer<? super Audience> otherwise) Filter audiences that receive this click callback.- Parameters:
- filter- the filter to test audiences with
- otherwise- the action to perform on the audience if the conditions are not met
- Returns:
- a filtered callback action
- Since:
- 4.13.0
 
 - 
requiringPermission@CheckReturnValue @Contract(pure=true) @NotNull default @NotNull ClickCallback<T> requiringPermission(@NotNull @NotNull java.lang.String permission) Require that audiences receiving this callback have a certain permission.For audiences without permissions information, this test will always fail. Actions from audiences that do not match this predicate will be silently ignored. - Parameters:
- permission- the permission to check
- Returns:
- a modified callback
- Since:
- 4.13.0
 
 - 
requiringPermission@CheckReturnValue @Contract(pure=true) @NotNull default @NotNull ClickCallback<T> requiringPermission(@NotNull @NotNull java.lang.String permission, @Nullable @Nullable java.util.function.Consumer<? super Audience> otherwise) Require that audiences receiving this callback have a certain permission.For audiences without permissions information, this test will always fail. - Parameters:
- permission- the permission to check
- otherwise- the action to perform on the audience if the conditions are not met
- Returns:
- a modified callback
- Since:
- 4.13.0
 
 
- 
 
-