Class ViaDialogActionBuilder
java.lang.Object
io.github.projectunified.unidialog.viaversion.action.ViaDialogActionBuilder
- All Implemented Interfaces:
DialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder>
public class ViaDialogActionBuilder
extends Object
implements DialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder>
A ViaVersion-based implementation of
DialogActionBuilder for building dialog actions.-
Field Summary
Fields inherited from interface io.github.projectunified.unidialog.core.action.DialogActionBuilder
DEFAULT_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionViaDialogActionBuilder(String defaultNamespace, Function<String, com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer) Constructor for ViaDialogActionBuilder -
Method Summary
Modifier and TypeMethodDescriptioncopyToClipboard(String value) Set the action to be a copy-to-clipboard actiondynamicCustom(String id) Set the action to be a dynamic custom actiondynamicCustom(String namespace, String id) Set the action to be a dynamic custom action with a namespacedynamicRunCommand(String template) Set the action to be a dynamic run command actioncom.viaversion.nbt.tag.CompoundTaggetAction(com.viaversion.viaversion.util.SerializerVersion base, com.viaversion.viaversion.util.SerializerVersion target) Build the button tag for the given target serializerlabel(com.viaversion.viaversion.libs.mcstructs.text.TextComponent label) Set the label for the actionSet the label for the dialog actionSet the action to be an open-URL actionrunCommand(String command) Set the action to be a run command actionshowDialog(DialogOpener dialogOpener) Set the action to be a show dialog actionshowDialog(ViaDialog<?> dialog) Set the action to be a show dialog actionshowDialog(String namespace, String dialogId) Set the action to be a show dialog actionsuggestCommand(String command) Set the action to be a suggest command actiontooltip(@Nullable com.viaversion.viaversion.libs.mcstructs.text.TextComponent tooltip) Set the tooltip for the actionSet the tooltip for the dialog actionwidth(int width) Set the width for the dialog action
-
Constructor Details
-
ViaDialogActionBuilder
public ViaDialogActionBuilder(String defaultNamespace, Function<String, com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer) Constructor for ViaDialogActionBuilder- Parameters:
defaultNamespace- the default namespace for custom actionscomponentDeserializer- the function to deserialize components from strings
-
-
Method Details
-
label
public ViaDialogActionBuilder label(com.viaversion.viaversion.libs.mcstructs.text.TextComponent label) Set the label for the action- Parameters:
label- the label- Returns:
- the builder itself for method chaining
-
label
Description copied from interface:DialogActionBuilderSet the label for the dialog action- Specified by:
labelin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
label- the label to set- Returns:
- the current instance of the builder for method chaining
-
tooltip
public ViaDialogActionBuilder tooltip(@Nullable @Nullable com.viaversion.viaversion.libs.mcstructs.text.TextComponent tooltip) Set the tooltip for the action- Parameters:
tooltip- the tooltip- Returns:
- the builder itself for method chaining
-
tooltip
Description copied from interface:DialogActionBuilderSet the tooltip for the dialog action- Specified by:
tooltipin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
tooltip- the tooltip to set, can be null- Returns:
- the current instance of the builder for method chaining
-
width
Description copied from interface:DialogActionBuilderSet the width for the dialog action- Specified by:
widthin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
width- the width to set- Returns:
- the current instance of the builder for method chaining
-
copyToClipboard
Description copied from interface:DialogActionBuilderSet the action to be a copy-to-clipboard action- Specified by:
copyToClipboardin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
value- the value to copy to the clipboard- Returns:
- the current instance of the builder for method chaining
-
dynamicCustom
Description copied from interface:DialogActionBuilderSet the action to be a dynamic custom action- Specified by:
dynamicCustomin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
id- the identifier for the dynamic custom action- Returns:
- the current instance of the builder for method chaining
-
dynamicCustom
Description copied from interface:DialogActionBuilderSet the action to be a dynamic custom action with a namespace- Specified by:
dynamicCustomin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
namespace- the namespace for the dynamic custom actionid- the identifier for the dynamic custom action- Returns:
- the current instance of the builder for method chaining
-
dynamicRunCommand
Description copied from interface:DialogActionBuilderSet the action to be a dynamic run command action- Specified by:
dynamicRunCommandin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
template- the command template to run- Returns:
- the current instance of the builder for method chaining
-
openUrl
Description copied from interface:DialogActionBuilderSet the action to be an open-URL action- Specified by:
openUrlin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
url- the URL to open- Returns:
- the current instance of the builder for method chaining
-
runCommand
Description copied from interface:DialogActionBuilderSet the action to be a run command action- Specified by:
runCommandin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
command- the command to run- Returns:
- the current instance of the builder for method chaining
-
suggestCommand
Description copied from interface:DialogActionBuilderSet the action to be a suggest command action- Specified by:
suggestCommandin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
command- the command to suggest- Returns:
- the current instance of the builder for method chaining
-
showDialog
Description copied from interface:DialogActionBuilderSet the action to be a show dialog action- Specified by:
showDialogin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
dialog- the dialog to show- Returns:
- the current instance of the builder for method chaining
-
showDialog
Description copied from interface:DialogActionBuilderSet the action to be a show dialog action- Specified by:
showDialogin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
namespace- the namespace of the dialogdialogId- the identifier of the dialog to show- Returns:
- the current instance of the builder for method chaining
-
showDialog
Description copied from interface:DialogActionBuilderSet the action to be a show dialog action- Specified by:
showDialogin interfaceDialogActionBuilder<ViaDialog<?>,ViaDialogActionBuilder> - Parameters:
dialogOpener- the dialog opener to use for showing the dialog- Returns:
- the current instance of the builder for method chaining
-
getAction
public com.viaversion.nbt.tag.CompoundTag getAction(com.viaversion.viaversion.util.SerializerVersion base, com.viaversion.viaversion.util.SerializerVersion target) Build the button tag for the given target serializer- Parameters:
base- the serializer of the version the components are created fortarget- the serializer of the version the dialog is sent to- Returns:
- the button tag
-