Class ViaConfirmationDialog
java.lang.Object
io.github.projectunified.unidialog.viaversion.dialog.ViaDialog<ViaConfirmationDialog>
io.github.projectunified.unidialog.viaversion.dialog.ViaConfirmationDialog
- All Implemented Interfaces:
ConfirmationDialog<ViaItem,,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaDialog<?>, ViaDialogActionBuilder, ViaConfirmationDialog> Dialog<ViaItem,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaConfirmationDialog>
public class ViaConfirmationDialog
extends ViaDialog<ViaConfirmationDialog>
implements ConfirmationDialog<ViaItem,ViaDialogBodyBuilder,ViaDialogInputBuilder,ViaDialog<?>,ViaDialogActionBuilder,ViaConfirmationDialog>
A ViaVersion-based implementation of
ConfirmationDialog for building confirmation dialogs.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.projectunified.unidialog.core.dialog.Dialog
Dialog.AfterAction -
Constructor Summary
ConstructorsConstructorDescriptionViaConfirmationDialog(String defaultNamespace, Function<String, com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer) Constructor for ViaConfirmationDialog -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the confirmation dialog has a "no" action definedbooleanCheck if the confirmation dialog has a "yes" action definednoAction(Consumer<ViaDialogActionBuilder> action) Set the action for the "no" button in the confirmation dialogprotected voidwriteDialogType(com.viaversion.nbt.tag.CompoundTag tag, com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion) Write the type-specific fields of this dialog, including thetypekeyyesAction(Consumer<ViaDialogActionBuilder> action) Set the action for the "yes" button in the confirmation dialogMethods inherited from class io.github.projectunified.unidialog.viaversion.dialog.ViaDialog
afterAction, body, canCloseWithEscape, deserialize, externalTitle, externalTitle, getActionBuilder, getDialogTag, getDialogTag, input, opener, pause, title, titleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.unidialog.core.dialog.Dialog
afterAction, body, body, canCloseWithEscape, externalTitle, input, input, opener, pause, title
-
Constructor Details
-
ViaConfirmationDialog
public ViaConfirmationDialog(String defaultNamespace, Function<String, com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer) Constructor for ViaConfirmationDialog- Parameters:
defaultNamespace- the default namespace for custom actionscomponentDeserializer- the function to deserialize components from strings
-
-
Method Details
-
yesAction
Description copied from interface:ConfirmationDialogSet the action for the "yes" button in the confirmation dialog- Specified by:
yesActionin interfaceConfirmationDialog<ViaItem,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaDialog<?>, ViaDialogActionBuilder, ViaConfirmationDialog> - Parameters:
action- the action to be performed when the "yes" button is clicked- Returns:
- the confirmation dialog itself for method chaining
-
noAction
Description copied from interface:ConfirmationDialogSet the action for the "no" button in the confirmation dialog- Specified by:
noActionin interfaceConfirmationDialog<ViaItem,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaDialog<?>, ViaDialogActionBuilder, ViaConfirmationDialog> - Parameters:
action- the action to be performed when the "no" button is clicked- Returns:
- the confirmation dialog itself for method chaining
-
hasYesAction
public boolean hasYesAction()Description copied from interface:ConfirmationDialogCheck if the confirmation dialog has a "yes" action defined- Specified by:
hasYesActionin interfaceConfirmationDialog<ViaItem,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaDialog<?>, ViaDialogActionBuilder, ViaConfirmationDialog> - Returns:
- true if a "yes" action is defined, false otherwise
-
hasNoAction
public boolean hasNoAction()Description copied from interface:ConfirmationDialogCheck if the confirmation dialog has a "no" action defined- Specified by:
hasNoActionin interfaceConfirmationDialog<ViaItem,ViaDialogBodyBuilder, ViaDialogInputBuilder, ViaDialog<?>, ViaDialogActionBuilder, ViaConfirmationDialog> - Returns:
- true if a "no" action is defined, false otherwise
-
writeDialogType
protected void writeDialogType(com.viaversion.nbt.tag.CompoundTag tag, com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion) Description copied from class:ViaDialogWrite the type-specific fields of this dialog, including thetypekey- Specified by:
writeDialogTypein classViaDialog<ViaConfirmationDialog>- Parameters:
tag- the tag to write intobaseVersion- the serializer of the server version the dialog is created fortargetVersion- the serializer of the version the dialog is sent to
-