Class PaperDialog<T extends PaperDialog<T>>
java.lang.Object
io.github.projectunified.unidialog.paper.dialog.PaperDialog<T>
- All Implemented Interfaces:
AdventureDialog<org.bukkit.inventory.ItemStack,
,PaperDialogBodyBuilder, PaperDialogInputBuilder, T> AdventureSupport
,Dialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T>
- Direct Known Subclasses:
PaperConfirmationDialog
,PaperDialogListDialog
,PaperMultiActionDialog
,PaperNoticeDialog
,PaperServerLinksDialog
public abstract class PaperDialog<T extends PaperDialog<T>>
extends Object
implements AdventureDialog<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder,PaperDialogInputBuilder,T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.projectunified.unidialog.core.dialog.Dialog
Dialog.AfterAction
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PaperDialog
(String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) -
Method Summary
Modifier and TypeMethodDescriptionafterAction
(Dialog.AfterAction afterAction) Set the action to be performed after an action is taken in the dialogbody
(Consumer<PaperDialogBodyBuilder> bodyBuilder) Set the body of the dialogcanCloseWithEscape
(boolean canCloseWithEscape) Set the option to allow the dialog to be closed with the escape keyexternalTitle
(@Nullable net.kyori.adventure.text.Component externalTitle) Set the external title of the dialog, which is used for displaying the dialog in a multi-dialog dialogprotected io.papermc.paper.registry.data.dialog.ActionButton
getAction
(Consumer<PaperDialogActionBuilder> actionBuilder) Get the deserializer function that converts a string to aComponent
final io.papermc.paper.dialog.Dialog
Create a dialog using the provided factoryfinal Consumer
<io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> Get the dialog builder consumer that can be used to create a dialogprotected abstract io.papermc.paper.registry.data.dialog.type.DialogType
input
(String key, Consumer<PaperDialogInputBuilder> inputBuilder) Set the input for the dialogopener()
Create an opener for the dialogpause
(boolean pause) Set the option to pause the game while the dialog is openfinal void
register
(String dialogId, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the default namespace and the provided dialog ID using the given event.final void
register
(String dialogId, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the default namespace and the provided dialog ID in the given registry.final void
register
(String namespace, String dialogId, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the default namespace and the provided dialog ID using the given event.final void
register
(String namespace, String dialogId, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the default namespace and the provided dialog ID in the given registry.final void
register
(net.kyori.adventure.key.Key key, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the provided key using the given event.final void
register
(net.kyori.adventure.key.Key key, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the provided key in the given registry.title
(net.kyori.adventure.text.Component title) Set the title of the dialogMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.projectunified.unidialog.adventure.dialog.AdventureDialog
externalTitle, title
Methods inherited from interface io.github.projectunified.unidialog.adventure.support.AdventureSupport
deserialize
-
Constructor Details
-
PaperDialog
-
-
Method Details
-
title
Description copied from interface:AdventureDialog
Set the title of the dialog- Specified by:
title
in interfaceAdventureDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
title
- the title of the dialog- Returns:
- the dialog itself for method chaining
-
externalTitle
Description copied from interface:AdventureDialog
Set the external title of the dialog, which is used for displaying the dialog in a multi-dialog dialog- Specified by:
externalTitle
in interfaceAdventureDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
externalTitle
- the external title of the dialog- Returns:
- the dialog itself for method chaining
-
getComponentDeserializer
Description copied from interface:AdventureSupport
Get the deserializer function that converts a string to aComponent
- Specified by:
getComponentDeserializer
in interfaceAdventureSupport
- Returns:
- the function that deserializes a string into a Component
-
canCloseWithEscape
Description copied from interface:Dialog
Set the option to allow the dialog to be closed with the escape key- Specified by:
canCloseWithEscape
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
canCloseWithEscape
- whether the dialog can be closed with the escape key- Returns:
- the dialog itself for method chaining
-
pause
Description copied from interface:Dialog
Set the option to pause the game while the dialog is open- Specified by:
pause
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
pause
- whether the dialog should pause the game- Returns:
- the dialog itself for method chaining
-
afterAction
Description copied from interface:Dialog
Set the action to be performed after an action is taken in the dialog- Specified by:
afterAction
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
afterAction
- the action to be performed after an action is taken- Returns:
- the dialog itself for method chaining
-
body
Description copied from interface:Dialog
Set the body of the dialog- Specified by:
body
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
bodyBuilder
- the body builder for the dialog- Returns:
- the dialog itself for method chaining
-
input
Description copied from interface:Dialog
Set the input for the dialog- Specified by:
input
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Parameters:
key
- the key for the inputinputBuilder
- the input builder for the dialog- Returns:
- the dialog itself for method chaining
-
getAction
protected io.papermc.paper.registry.data.dialog.ActionButton getAction(Consumer<PaperDialogActionBuilder> actionBuilder) -
getDialogType
protected abstract io.papermc.paper.registry.data.dialog.type.DialogType getDialogType() -
getDialogBuilder
public final Consumer<io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> getDialogBuilder()Get the dialog builder consumer that can be used to create a dialog- Returns:
- a consumer that accepts a DialogRegistryEntry.Builder
-
getDialog
public final io.papermc.paper.dialog.Dialog getDialog()Create a dialog using the provided factory- Returns:
- a Dialog instance created using the dialog builder
-
register
public final void register(net.kyori.adventure.key.Key key, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the provided key in the given registry.- Parameters:
key
- the key to register the dialog underregistry
- the registry to register the dialog in
-
register
public final void register(net.kyori.adventure.key.Key key, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the provided key using the given event.- Parameters:
key
- the key to register the dialog underevent
- the registry compose event to register the dialog in
-
register
public final void register(String namespace, String dialogId, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the default namespace and the provided dialog ID in the given registry.- Parameters:
namespace
- the namespace to usedialogId
- the dialog ID to register underregistry
- the registry to register the dialog in
-
register
public final void register(String namespace, String dialogId, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the default namespace and the provided dialog ID using the given event.- Parameters:
namespace
- the namespace to usedialogId
- the dialog ID to register underevent
- the registry compose event to register the dialog in
-
register
public final void register(String dialogId, io.papermc.paper.registry.event.WritableRegistry<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> registry) Register the dialog with the default namespace and the provided dialog ID in the given registry.- Parameters:
dialogId
- the dialog ID to register underregistry
- the registry to register the dialog in
-
register
public final void register(String dialogId, io.papermc.paper.registry.event.RegistryComposeEvent<io.papermc.paper.dialog.Dialog, io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder> event) Register the dialog with the default namespace and the provided dialog ID using the given event.- Parameters:
dialogId
- the dialog ID to register underevent
- the registry compose event to register the dialog in
-
opener
Description copied from interface:Dialog
Create an opener for the dialog- Specified by:
opener
in interfaceDialog<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, T extends PaperDialog<T>> - Returns:
- the dialog opener
-