Class PaperDialogManager
java.lang.Object
io.github.projectunified.unidialog.paper.PaperDialogManager
- All Implemented Interfaces:
DialogManager<org.bukkit.inventory.ItemStack,
,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> org.bukkit.event.Listener
public class PaperDialogManager
extends Object
implements DialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder,PaperDialogInputBuilder,PaperDialog<?>,PaperDialogActionBuilder>, org.bukkit.event.Listener
-
Constructor Summary
ConstructorsConstructorDescriptionPaperDialogManager
(org.bukkit.plugin.Plugin plugin) Constructor for PaperDialogManager that uses the plugin's name as the default namespace.PaperDialogManager
(org.bukkit.plugin.Plugin plugin, String defaultNamespace) Constructor for PaperDialogManager.PaperDialogManager
(org.bukkit.plugin.Plugin plugin, String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PaperDialogManagerPaperDialogManager
(org.bukkit.plugin.Plugin plugin, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PaperDialogManager that uses the plugin's name as the default namespace. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 dialogvoid
onCustomClick
(io.papermc.paper.event.player.PlayerCustomClickEvent event) void
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
-
PaperDialogManager
public PaperDialogManager(org.bukkit.plugin.Plugin plugin, String defaultNamespace, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PaperDialogManager- Parameters:
plugin
- the plugin instancedefaultNamespace
- the default namespace, used byregisterCustomAction(String, BiConsumer)
andDialogActionBuilder.dynamicCustom(String)
componentDeserializer
- a function to deserialize components from strings
-
PaperDialogManager
Constructor for PaperDialogManager. UsesLegacyComponentSerializer.legacySection()
to deserialize components.- Parameters:
plugin
- the plugin instancedefaultNamespace
- the default namespace, used byregisterCustomAction(String, BiConsumer)
andDialogActionBuilder.dynamicCustom(String)
-
PaperDialogManager
public PaperDialogManager(org.bukkit.plugin.Plugin plugin, Function<String, net.kyori.adventure.text.Component> componentDeserializer) Constructor for PaperDialogManager that uses the plugin's name as the default namespace.- Parameters:
plugin
- the plugin instancecomponentDeserializer
- a function to deserialize components from strings
-
PaperDialogManager
public PaperDialogManager(org.bukkit.plugin.Plugin plugin) Constructor for PaperDialogManager that uses the plugin's name as the default namespace. UsesLegacyComponentSerializer.legacySection()
to deserialize components.- Parameters:
plugin
- the plugin instance
-
-
Method Details
-
createConfirmationDialog
Description copied from interface:DialogManager
Create a confirmation dialog- Specified by:
createConfirmationDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of ConfirmationDialog
-
createMultiActionDialog
Description copied from interface:DialogManager
Create a multi-action dialog- Specified by:
createMultiActionDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of MultiActionDialog
-
createServerLinksDialog
Description copied from interface:DialogManager
Create a server links dialog- Specified by:
createServerLinksDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of ServerLinksDialog
-
createNoticeDialog
Description copied from interface:DialogManager
Create a notice dialog- Specified by:
createNoticeDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of NoticeDialog
-
createDialogListDialog
Description copied from interface:DialogManager
Create a dialog list dialog- Specified by:
createDialogListDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of DialogListDialog
-
register
public void register()Description copied from interface:DialogManager
Register the dialog manager- Specified by:
register
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder>
-
unregister
public void unregister()Description copied from interface:DialogManager
Unregister the dialog manager- Specified by:
unregister
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder>
-
onCustomClick
public void onCustomClick(io.papermc.paper.event.player.PlayerCustomClickEvent event) -
unregisterCustomAction
Description copied from interface:DialogManager
Unregister a custom action by its unique identifier.- Specified by:
unregisterCustomAction
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - 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<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - 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<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder>
-
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<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - 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
-
registerCustomAction
Description copied from interface:DialogManager
Register a custom action with a unique identifier.- Specified by:
registerCustomAction
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Parameters:
id
- the unique identifier for the custom actionaction
- the action to be executed, taking a UUID and a map of parameters
-
clearDialog
Description copied from interface:DialogManager
Clear the current dialog associated with the given player UUID.- Specified by:
clearDialog
in interfaceDialogManager<org.bukkit.inventory.ItemStack,
PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Parameters:
uuid
- the unique identifier of the player whose dialog should be cleared- Returns:
- true if the dialog was successfully cleared, false otherwise
-