Class PocketEventsDialogManager
java.lang.Object
io.github.projectunified.unidialog.packetevents.PocketEventsDialogManager
- All Implemented Interfaces:
DialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
public abstract class PocketEventsDialogManager
extends Object
implements DialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder,PEDialogInputBuilder,PEDialog<?>,PEDialogActionBuilder>
-
Constructor Summary
ConstructorsConstructorDescriptionPocketEventsDialogManager(String defaultNamespace) Constructor for PocketEventsDialogManagee.PocketEventsDialogManager(String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PocketEventsDialogManager -
Method Summary
Modifier and TypeMethodDescriptionvoidclearDialog(com.github.retrooper.packetevents.protocol.player.User user) Clear the dialog for a user, automatically determining if it is a configuration dialog based on the user's connection state.voidclearDialog(com.github.retrooper.packetevents.protocol.player.User user, boolean configuration) Clear the dialog for a user, optionally specifying if it is a configuration dialog.booleanclearDialog(UUID uuid) Clear the current dialog associated with the given player UUID.Create a confirmation dialogCreate a dialog list dialogCreate a multi-action dialogCreate a notice dialogCreate a server links dialogprotected abstract @Nullable ObjectGet the player object for a given UUIDprotected abstract UUIDgetPlayerId(Object player) Get the UUID of a player objectvoidregister()Register the dialog managervoidregisterCustomAction(String namespace, String id, Consumer<DialogPayload> action) Register a custom action with a unique identifier.voidregisterCustomAction(String id, Consumer<DialogPayload> action) Register a custom action with a unique identifier.voidUnregister the dialog managervoidUnregister all custom actions.voidUnregister a custom action by its unique identifier.voidunregisterCustomAction(String namespace, String id) Unregister a custom action by its namespace and unique identifier.Methods 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.DialogManager
registerCustomAction, registerCustomAction
-
Constructor Details
-
PocketEventsDialogManager
public PocketEventsDialogManager(String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PocketEventsDialogManager- Parameters:
defaultNamespace- the default namespace, used byDialogManager.registerCustomAction(String, BiConsumer)andDialogActionBuilder.dynamicCustom(String)componentDeserializer- a function to deserialize components from strings
-
PocketEventsDialogManager
Constructor for PocketEventsDialogManagee. UsesLegacyComponentSerializer.legacySection()to deserialize components.- Parameters:
defaultNamespace- the default namespace, used byDialogManager.registerCustomAction(String, BiConsumer)andDialogActionBuilder.dynamicCustom(String)
-
-
Method Details
-
getPlayer
Get the player object for a given UUID- Parameters:
uuid- the UUID of the player- Returns:
- the player object, or null if not found
-
getPlayerId
Get the UUID of a player object- Parameters:
player- the player object- Returns:
- the UUID of the player
-
createConfirmationDialog
Description copied from interface:DialogManagerCreate a confirmation dialog- Specified by:
createConfirmationDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of ConfirmationDialog
-
createMultiActionDialog
Description copied from interface:DialogManagerCreate a multi-action dialog- Specified by:
createMultiActionDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of MultiActionDialog
-
createServerLinksDialog
Description copied from interface:DialogManagerCreate a server links dialog- Specified by:
createServerLinksDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of ServerLinksDialog
-
createNoticeDialog
Description copied from interface:DialogManagerCreate a notice dialog- Specified by:
createNoticeDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of NoticeDialog
-
createDialogListDialog
Description copied from interface:DialogManagerCreate a dialog list dialog- Specified by:
createDialogListDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of DialogListDialog
-
register
public void register()Description copied from interface:DialogManagerRegister the dialog manager- Specified by:
registerin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
-
unregister
public void unregister()Description copied from interface:DialogManagerUnregister the dialog manager- Specified by:
unregisterin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
-
registerCustomAction
Description copied from interface:DialogManagerRegister a custom action with a unique identifier.- Specified by:
registerCustomActionin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
id- the unique identifier for the custom actionaction- the action to be executed, taking a payload
-
registerCustomAction
Description copied from interface:DialogManagerRegister a custom action with a unique identifier.- Specified by:
registerCustomActionin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
id- the unique identifier for the custom actionaction- the action to be executed, taking a payload
-
unregisterCustomAction
Description copied from interface:DialogManagerUnregister a custom action by its unique identifier.- Specified by:
unregisterCustomActionin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
id- the unique identifier of the custom action to be unregistered
-
unregisterCustomAction
Description copied from interface:DialogManagerUnregister a custom action by its namespace and unique identifier.- Specified by:
unregisterCustomActionin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
namespace- the namespace of the custom actionid- the unique identifier of the custom action to be unregistered
-
unregisterAllCustomActions
public void unregisterAllCustomActions()Description copied from interface:DialogManagerUnregister all custom actions.- Specified by:
unregisterAllCustomActionsin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
-
clearDialog
public void clearDialog(com.github.retrooper.packetevents.protocol.player.User user, boolean configuration) Clear the dialog for a user, optionally specifying if it is a configuration dialog.- Parameters:
user- the user to clear the dialog forconfiguration- if true, clears as a configuration dialog; if false, clears as a play dialog
-
clearDialog
public void clearDialog(com.github.retrooper.packetevents.protocol.player.User user) Clear the dialog for a user, automatically determining if it is a configuration dialog based on the user's connection state.- Parameters:
user- the user to clear the dialog for
-
clearDialog
Description copied from interface:DialogManagerClear the current dialog associated with the given player UUID.- Specified by:
clearDialogin interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
uuid- the unique identifier of the player whose dialog should be cleared- Returns:
- true if the dialog was successfully cleared, false otherwise
-