Class PEDialog<T extends PEDialog<T>>

java.lang.Object
io.github.projectunified.unidialog.packetevents.dialog.PEDialog<T>
Type Parameters:
T - the type of the dialog implementation, for method chaining
All Implemented Interfaces:
AdventureDialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T>, AdventureSupport, Dialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T>
Direct Known Subclasses:
PEConfirmationDialog, PEDialogListDialog, PEMultiActionDialog, PENoticeDialog, PEServerLinksDialog

public abstract class PEDialog<T extends PEDialog<T>> extends Object implements AdventureDialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T>
A PacketEvents-based implementation of AdventureDialog for building dialogs.
  • 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
    PEDialog(String defaultNamespace, Function<String,net.kyori.adventure.text.Component> componentDeserializer, Function<UUID,@Nullable Object> playerFunction)
    Constructor for PEDialog
  • 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
    protected abstract com.github.retrooper.packetevents.protocol.dialog.Dialog
    constructDialog(com.github.retrooper.packetevents.protocol.dialog.CommonDialogData commonDialogData)
    Construct the PacketEvents dialog with the given common dialog data
    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 com.github.retrooper.packetevents.protocol.dialog.button.ActionButton
    Build an action button from an action consumer
    Function<String,net.kyori.adventure.text.Component>
    Get the deserializer function that converts a string to a Component
    final com.github.retrooper.packetevents.protocol.dialog.Dialog
    Get the PacketEvents dialog
    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
    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

    • PEDialog

      protected PEDialog(String defaultNamespace, Function<String,net.kyori.adventure.text.Component> componentDeserializer, Function<UUID,@Nullable Object> playerFunction)
      Constructor for PEDialog
      Parameters:
      defaultNamespace - the default namespace, used by DialogActionBuilder.dynamicCustom(String)
      componentDeserializer - a function to deserialize components from strings
      playerFunction - a function to get the player object for a player UUID
  • Method Details

    • 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
    • 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<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<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<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<T>>
      Parameters:
      externalTitle - the external title of the dialog
      Returns:
      the dialog itself for method chaining
    • 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<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<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<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<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<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<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<PEDialogBodyBuilder> bodyBuilder)
      Description copied from interface: Dialog
      Set the body of the dialog
      Specified by:
      body in interface Dialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<T>>
      Parameters:
      bodyBuilder - the body builder for the dialog
      Returns:
      the dialog itself for method chaining
    • input

      public T input(String key, Consumer<PEDialogInputBuilder> inputBuilder)
      Description copied from interface: Dialog
      Set the input for the dialog
      Specified by:
      input in interface Dialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<T>>
      Parameters:
      key - the key for the input
      inputBuilder - the input builder for the dialog
      Returns:
      the dialog itself for method chaining
    • getAction

      protected com.github.retrooper.packetevents.protocol.dialog.button.ActionButton getAction(Consumer<PEDialogActionBuilder> action)
      Build an action button from an action consumer
      Parameters:
      action - the action consumer used to build the action
      Returns:
      the built action button
    • constructDialog

      protected abstract com.github.retrooper.packetevents.protocol.dialog.Dialog constructDialog(com.github.retrooper.packetevents.protocol.dialog.CommonDialogData commonDialogData)
      Construct the PacketEvents dialog with the given common dialog data
      Parameters:
      commonDialogData - the common dialog data
      Returns:
      the constructed dialog
    • getDialog

      public final com.github.retrooper.packetevents.protocol.dialog.Dialog getDialog()
      Get the PacketEvents dialog
      Returns:
      the dialog
    • opener

      public PEDialogOpener opener()
      Description copied from interface: Dialog
      Create an opener for the dialog
      Specified by:
      opener in interface Dialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,T extends PEDialog<T>>
      Returns:
      the dialog opener