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 TypeMethodDescriptionvoid
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.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.boolean
clearDialog
(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 Object
Get the player object for a given UUIDprotected abstract UUID
getPlayerId
(Object player) Get the UUID of a player objectvoid
register()
Register the dialog managervoid
registerCustomAction
(String namespace, String id, BiConsumer<UUID, Map<String, String>> action) Register a custom action with a namespace and a unique identifier.void
registerCustomAction
(String id, BiConsumer<UUID, Map<String, String>> action) Register a custom action with a unique identifier.void
Unregister the dialog managervoid
Unregister all custom actions.void
Unregister a custom action by its unique identifier.void
unregisterCustomAction
(String namespace, String id) Unregister a custom action by its namespace and unique identifier.
-
Constructor Details
-
PocketEventsDialogManager
public PocketEventsDialogManager(String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PocketEventsDialogManager- Parameters:
defaultNamespace
- the default namespace, used byregisterCustomAction(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 byregisterCustomAction(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:DialogManager
Create a confirmation dialog- Specified by:
createConfirmationDialog
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of ConfirmationDialog
-
createMultiActionDialog
Description copied from interface:DialogManager
Create a multi-action dialog- Specified by:
createMultiActionDialog
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of MultiActionDialog
-
createServerLinksDialog
Description copied from interface:DialogManager
Create a server links dialog- Specified by:
createServerLinksDialog
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of ServerLinksDialog
-
createNoticeDialog
Description copied from interface:DialogManager
Create a notice dialog- Specified by:
createNoticeDialog
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Returns:
- a new instance of NoticeDialog
-
createDialogListDialog
Description copied from interface:DialogManager
Create a dialog list dialog- Specified by:
createDialogListDialog
in 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:DialogManager
Register the dialog manager- Specified by:
register
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
-
unregister
public void unregister()Description copied from interface:DialogManager
Unregister the dialog manager- Specified by:
unregister
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder>
-
registerCustomAction
Description copied from interface:DialogManager
Register a custom action with a unique identifier.- Specified by:
registerCustomAction
in 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 UUID and a map of parameters
-
registerCustomAction
public void registerCustomAction(String namespace, String id, BiConsumer<UUID, Map<String, String>> action) Description copied from interface:DialogManager
Register a custom action with a namespace and a unique identifier.- Specified by:
registerCustomAction
in interfaceDialogManager<com.github.retrooper.packetevents.protocol.item.ItemStack,
PEDialogBodyBuilder, PEDialogInputBuilder, PEDialog<?>, PEDialogActionBuilder> - Parameters:
namespace
- the namespace for the custom actionid
- the unique identifier for the custom actionaction
- the action to be executed, taking a UUID and a map of parameters
-
unregisterCustomAction
Description copied from interface:DialogManager
Unregister a custom action by its unique identifier.- Specified by:
unregisterCustomAction
in 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:DialogManager
Unregister a custom action by its namespace and unique identifier.- Specified by:
unregisterCustomAction
in 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:DialogManager
Unregister all custom actions.- Specified by:
unregisterAllCustomActions
in 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:DialogManager
Clear the current dialog associated with the given player UUID.- Specified by:
clearDialog
in 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
-