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

    Constructors
    Modifier
    Constructor
    Description
    protected
    PaperDialog(String defaultNamespace, Function<String,net.kyori.adventure.text.Component> componentDeserializer)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Set the action to be performed after an action is taken in the dialog
    Set the body of the dialog
    canCloseWithEscape(boolean canCloseWithEscape)
    Set the option to allow the dialog to be closed with the escape key
    externalTitle(@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 dialog
    protected io.papermc.paper.registry.data.dialog.ActionButton
     
    Function<String,net.kyori.adventure.text.Component>
    Get the deserializer function that converts a string to a Component
    final io.papermc.paper.dialog.Dialog
    Create a dialog using the provided factory
    final Consumer<io.papermc.paper.registry.data.dialog.DialogRegistryEntry.Builder>
    Get the dialog builder consumer that can be used to create a dialog
    protected abstract io.papermc.paper.registry.data.dialog.type.DialogType
     
    Set the input for the dialog
    Create an opener for the dialog
    pause(boolean pause)
    Set the option to pause the game while the dialog is open
    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.
    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 dialog

    Methods 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

    Methods inherited from interface io.github.projectunified.unidialog.core.dialog.Dialog

    body, input
  • Constructor Details

    • PaperDialog

      protected PaperDialog(String defaultNamespace, Function<String,net.kyori.adventure.text.Component> componentDeserializer)
  • Method Details

    • title

      public T title(net.kyori.adventure.text.Component title)
      Description copied from interface: AdventureDialog
      Set the title of the dialog
      Specified by:
      title in interface AdventureDialog<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

      public T externalTitle(@Nullable @Nullable net.kyori.adventure.text.Component 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 interface AdventureDialog<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

      public Function<String,net.kyori.adventure.text.Component> getComponentDeserializer()
      Description copied from interface: AdventureSupport
      Get the deserializer function that converts a string to a Component
      Specified by:
      getComponentDeserializer in interface AdventureSupport
      Returns:
      the function that deserializes a string into a Component
    • canCloseWithEscape

      public T canCloseWithEscape(boolean canCloseWithEscape)
      Description copied from interface: Dialog
      Set the option to allow the dialog to be closed with the escape key
      Specified by:
      canCloseWithEscape in interface Dialog<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

      public T pause(boolean pause)
      Description copied from interface: Dialog
      Set the option to pause the game while the dialog is open
      Specified by:
      pause in interface Dialog<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

      public T afterAction(Dialog.AfterAction afterAction)
      Description copied from interface: Dialog
      Set the action to be performed after an action is taken in the dialog
      Specified by:
      afterAction in interface Dialog<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

      public T body(Consumer<PaperDialogBodyBuilder> bodyBuilder)
      Description copied from interface: Dialog
      Set the body of the dialog
      Specified by:
      body in interface Dialog<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

      public T input(String key, Consumer<PaperDialogInputBuilder> inputBuilder)
      Description copied from interface: Dialog
      Set the input for the dialog
      Specified by:
      input in interface Dialog<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder,PaperDialogInputBuilder,T extends PaperDialog<T>>
      Parameters:
      key - the key for the input
      inputBuilder - 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 under
      registry - 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 under
      event - 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 use
      dialogId - the dialog ID to register under
      registry - 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 use
      dialogId - the dialog ID to register under
      event - 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 under
      registry - 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 under
      event - the registry compose event to register the dialog in
    • opener

      public PaperDialogOpener opener()
      Description copied from interface: Dialog
      Create an opener for the dialog
      Specified by:
      opener in interface Dialog<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder,PaperDialogInputBuilder,T extends PaperDialog<T>>
      Returns:
      the dialog opener