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 -
Method Summary
Modifier and TypeMethodDescriptionafterAction(Dialog.AfterAction afterAction) Set the action to be performed after an action is taken in the dialogbody(Consumer<PEDialogBodyBuilder> bodyBuilder) Set the body of the dialogcanCloseWithEscape(boolean canCloseWithEscape) Set the option to allow the dialog to be closed with the escape keyprotected abstract com.github.retrooper.packetevents.protocol.dialog.DialogconstructDialog(com.github.retrooper.packetevents.protocol.dialog.CommonDialogData commonDialogData) Construct the PacketEvents dialog with the given common dialog dataexternalTitle(@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 com.github.retrooper.packetevents.protocol.dialog.button.ActionButtongetAction(Consumer<PEDialogActionBuilder> action) Build an action button from an action consumerGet the deserializer function that converts a string to aComponentfinal com.github.retrooper.packetevents.protocol.dialog.DialogGet the PacketEvents dialoginput(String key, Consumer<PEDialogInputBuilder> 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 opentitle(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, waitMethods inherited from interface io.github.projectunified.unidialog.adventure.dialog.AdventureDialog
externalTitle, titleMethods inherited from interface io.github.projectunified.unidialog.adventure.support.AdventureSupport
deserialize
-
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 byDialogActionBuilder.dynamicCustom(String)componentDeserializer- a function to deserialize components from stringsplayerFunction- a function to get the player object for a player UUID
-
-
Method Details
-
getComponentDeserializer
Description copied from interface:AdventureSupportGet the deserializer function that converts a string to aComponent- Specified by:
getComponentDeserializerin interfaceAdventureSupport- Returns:
- the function that deserializes a string into a Component
-
title
Description copied from interface:AdventureDialogSet the title of the dialog- Specified by:
titlein interfaceAdventureDialog<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
Description copied from interface:AdventureDialogSet the external title of the dialog, which is used for displaying the dialog in a multi-dialog dialog- Specified by:
externalTitlein interfaceAdventureDialog<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
Description copied from interface:DialogSet the option to allow the dialog to be closed with the escape key- Specified by:
canCloseWithEscapein interfaceDialog<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
Description copied from interface:DialogSet the option to pause the game while the dialog is open- Specified by:
pausein interfaceDialog<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
Description copied from interface:DialogSet the action to be performed after an action is taken in the dialog- Specified by:
afterActionin interfaceDialog<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
Description copied from interface:DialogSet the body of the dialog- Specified by:
bodyin interfaceDialog<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
Description copied from interface:DialogSet the input for the dialog- Specified by:
inputin interfaceDialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, T extends PEDialog<T>> - Parameters:
key- the key for the inputinputBuilder- 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
Description copied from interface:DialogCreate an opener for the dialog- Specified by:
openerin interfaceDialog<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, T extends PEDialog<T>> - Returns:
- the dialog opener
-