Class ClickEvent.Action<T extends ClickEvent.Payload>
java.lang.Object
net.kyori.adventure.text.event.ClickEvent.Action<T>
- Type Parameters:
T- the payload type
- Direct Known Subclasses:
ClickEvent.Action.ChangePage, ClickEvent.Action.Custom, ClickEvent.Action.ShowDialog, ClickEvent.Action.TextCarrier
- Enclosing class:
ClickEvent<T extends ClickEvent.Payload>
public abstract static sealed class ClickEvent.Action<T extends ClickEvent.Payload>
extends Object
permits ClickEvent.Action.ChangePage, ClickEvent.Action.Custom, ClickEvent.Action.ShowDialog, ClickEvent.Action.TextCarrier
An enumeration of click event actions.
Note: although this interface is sealed, new implementations may be added at any time as and when needed.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classChanges the page of a book.static final classCopies text to the clipboard.static final classSends a custom event to the server.static final classOpens a file when clicked.static final classOpens a url when clicked.static final classRuns a command when clicked.static final classShows a dialog.static final classSuggests a command.static classAn action with a text payload. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClickEvent.Action.ChangePageChanges the page of a book.static final ClickEvent.Action.CopyToClipboardCopies text to the clipboard.static final ClickEvent.Action.CustomSends a custom event to the server.static final Index<String, ClickEvent.Action<?>> The name map.static final ClickEvent.Action.OpenFileOpens a file when clicked.static final ClickEvent.Action.OpenUrlOpens a url when clicked.static final ClickEvent.Action.RunCommandRuns a command when clicked.static final ClickEvent.Action.ShowDialogShows a dialog.static final ClickEvent.Action.SuggestCommandSuggests a command into the chat box. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanReturns if the provided payload is valid for this action.name()Returns the name of this action.booleanreadable()Tests if this action is readable.booleansupports(ClickEvent.Payload payload) Returns if this action supports the provided payload type.toString()voidValidates the provided payload, throwing an exception if the payload is not valid for this action.
-
Field Details
-
OPEN_URL
-
OPEN_FILE
Opens a file when clicked.This action is not readable, and may only be used locally on the client.
- Since:
- 4.0.0
-
RUN_COMMAND
Runs a command when clicked.- Since:
- 4.0.0
-
SUGGEST_COMMAND
Suggests a command into the chat box.- Since:
- 4.0.0
-
CHANGE_PAGE
Changes the page of a book.- Since:
- 4.0.0
-
COPY_TO_CLIPBOARD
Copies text to the clipboard.- Since:
- 4.0.0
- Since Minecraft:
- 1.15
-
SHOW_DIALOG
Shows a dialog.This action is not readable at this time until Adventure has a full Dialog API.
- Since:
- 4.22.0
- Since Minecraft:
- 1.21.6
-
CUSTOM
Sends a custom event to the server.- Since:
- 4.22.0
- Since Minecraft:
- 1.21.6
-
NAMES
-
-
Method Details
-
readable
public boolean readable()Tests if this action is readable.- Returns:
trueif this action is readable,falseif this action is not readable- Since:
- 4.0.0
-
supports
Returns if this action supports the provided payload type.Note: This method only checks if the type of the payload is supported, to check if the payload is compatible with this action, see
isValid(Payload).- Parameters:
payload- the payload- Returns:
trueif this action supports the payload type- Since:
- 4.22.0
-
isValid
Returns if the provided payload is valid for this action.- Parameters:
payload- the payload- Returns:
trueif the payload is valid for this action,falseotherwise- Since:
- 5.1.0
-
validate
Validates the provided payload, throwing an exception if the payload is not valid for this action.- Parameters:
payload- the payload- Throws:
IllegalArgumentException- if the payload is not valid for this action- Since:
- 5.1.0
-
name
-
toString
-
hashCode
-
equals
-