Interface DialogAction
- All Known Implementing Classes:
DialogAction.DynamicCustom, DialogAction.DynamicRunCommand, DialogAction.ShowDialog, DialogAction.Static
public sealed interface DialogAction
permits DialogAction.Static, DialogAction.ShowDialog, DialogAction.DynamicRunCommand, DialogAction.DynamicCustom
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAn action posting the dialog inputs back to the server.static final recordAn action running a macro command built from the dialog inputs.static final recordAn action opening another dialog.static final recordAn action mirroring a text component click event. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic DialogActioncallback(ClickCallback<Audience> callback) Runs server-side code when the button is pressed.static DialogActioncallback(ClickCallback<Audience> callback, ClickCallback.Options options) Runs server-side code when the button is pressed.static DialogActioncopyToClipboard(String value) Copies text to the player's clipboard.static DialogActionSends a bare event to the server, without any dialog input attached.static DialogActioncustom(Key id, @Nullable BinaryTagHolder payload) Sends an event with a fixed payload to the server.static DialogActiondynamicCustom(Key id) Sends every input value back to the server under a single identifier.static DialogActiondynamicCustom(Key id, @Nullable CompoundBinaryTag additions) Sends every input value back to the server, alongside some fixed data.static DialogActiondynamicRunCommand(String template) Builds a command from the dialog's inputs and runs it as the player.static DialogActionof(ClickEvent<?> event) Wraps an Adventure click event as a static dialog action.static DialogActionOpens a URL in the player's browser.static DialogActionrunCommand(String command) Runs a command as the player, who therefore needs the matching permission.static DialogActionshowDialog(Dialog dialog) Opens another dialog, defined inline or referenced from the registry.static DialogActionsuggestCommand(String command) Opens the chat box pre-filled with some text.
-
Method Details
-
of
Wraps an Adventure click event as a static dialog action.- Parameters:
event- the click event to perform- Returns:
- the action
- Throws:
IllegalArgumentException- ifeventopens a file, which dialogs do not support- Since:
- 0.1.0
-
openUrl
Opens a URL in the player's browser.- Parameters:
url- the address to open- Returns:
- the action
- Since:
- 0.1.0
-
runCommand
Runs a command as the player, who therefore needs the matching permission.- Parameters:
command- the command to run, with or without its leading slash- Returns:
- the action
- Since:
- 0.1.0
-
suggestCommand
Opens the chat box pre-filled with some text.- Parameters:
command- the text to suggest- Returns:
- the action
- Since:
- 0.1.0
-
copyToClipboard
Copies text to the player's clipboard.- Parameters:
value- the text to copy- Returns:
- the action
- Since:
- 0.1.0
-
callback
Runs server-side code when the button is pressed.- Parameters:
callback- the code to run, receiving the player who clicked- Returns:
- the action
- Since:
- 0.1.0
-
callback
@Contract("_, _ -> new") static DialogAction callback(ClickCallback<Audience> callback, ClickCallback.Options options) Runs server-side code when the button is pressed.- Parameters:
callback- the code to run, receiving the player who clickedoptions- how long the callback lives and how often it may fire- Returns:
- the action
- Since:
- 0.1.0
-
custom
Sends a bare event to the server, without any dialog input attached.- Parameters:
id- the identifier the server matches on- Returns:
- the action
- Since:
- 0.1.0
-
custom
Sends an event with a fixed payload to the server.- Parameters:
id- the identifier the server matches onpayload- the payload to attach, ornullfor none- Returns:
- the action
- Since:
- 0.1.0
-
showDialog
Opens another dialog, defined inline or referenced from the registry.- Parameters:
dialog- the dialog to open- Returns:
- the action
- Since:
- 0.1.0
-
dynamicRunCommand
Builds a command from the dialog's inputs and runs it as the player.- Parameters:
template- the macro command to run, with or without its leading slash- Returns:
- the action
- Since:
- 0.1.0
-
dynamicCustom
Sends every input value back to the server under a single identifier.- Parameters:
id- the identifier the server matches on- Returns:
- the action
- Since:
- 0.1.0
-
dynamicCustom
@Contract("_, _ -> new") static DialogAction dynamicCustom(Key id, @Nullable CompoundBinaryTag additions) Sends every input value back to the server, alongside some fixed data.- Parameters:
id- the identifier the server matches onadditions- extra tags merged into the payload next to the input values- Returns:
- the action
- Since:
- 0.1.0
-