Interface DialogAction
- All Known Subinterfaces:
DialogAction.CommandTemplateAction,DialogAction.CustomClickAction,DialogAction.StaticAction
public sealed interface DialogAction
permits DialogAction.CommandTemplateAction, DialogAction.CustomClickAction, DialogAction.StaticAction
Represents an action that can be performed in a dialog.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an action that executes a command template.static interfaceRepresents an action that executes a custom action with additional data.static interfaceRepresents an action that performs a static click event. -
Method Summary
Static MethodsModifier and TypeMethodDescriptioncommandTemplate(String template) Creates a new command template action.customClick(DialogActionCallback callback, net.kyori.adventure.text.event.ClickCallback.Options options) Creates a new custom click action that executes a custom action.customClick(net.kyori.adventure.key.Key id, @Nullable net.kyori.adventure.nbt.api.BinaryTagHolder additions) Creates a new custom click action that executes a custom action.static DialogAction.StaticActionstaticAction(net.kyori.adventure.text.event.ClickEvent value) Creates a new static action that performs a click event.
-
Method Details
-
commandTemplate
@Contract(pure=true, value="_ -> new") static DialogAction.CommandTemplateAction commandTemplate(String template) Creates a new command template action. The template format looks for$(variable_name)to substitute variables.variable_nameshould correspond to aDialogInput.key().- Parameters:
template- the command template to execute- Returns:
- a new command template action instance
-
staticAction
@Contract(pure=true, value="_ -> new") static DialogAction.StaticAction staticAction(net.kyori.adventure.text.event.ClickEvent value) Creates a new static action that performs a click event.- Parameters:
value- the click event to perform- Returns:
- a new static action instance
-
customClick
@Contract(pure=true, value="_, _ -> new") static DialogAction.CustomClickAction customClick(net.kyori.adventure.key.Key id, @Nullable net.kyori.adventure.nbt.api.BinaryTagHolder additions) Creates a new custom click action that executes a custom action. EachDialogInput.key()is added to the compound binary tag holder.- Parameters:
id- the identifier of the custom actionadditions- additional data to be sent with the action, or null if not needed- Returns:
- a new custom click action instance
-
customClick
@Contract(pure=true, value="_, _ -> new") static DialogAction.CustomClickAction customClick(DialogActionCallback callback, net.kyori.adventure.text.event.ClickCallback.Options options) Creates a new custom click action that executes a custom action.- Parameters:
callback- the custom action to executeoptions- the options for the custom action- Returns:
- a new custom click action instance
-