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 TypeMethodDescriptionbooleanclearDialog(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 dialogvoidonCustomClick(io.papermc.paper.event.player.PlayerCustomClickEvent event) voidregister()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
-
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 byDialogManager.registerCustomAction(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 byDialogManager.registerCustomAction(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:DialogManagerCreate a confirmation dialog- Specified by:
createConfirmationDialogin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of ConfirmationDialog
-
createMultiActionDialog
Description copied from interface:DialogManagerCreate a multi-action dialog- Specified by:
createMultiActionDialogin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of MultiActionDialog
-
createServerLinksDialog
Description copied from interface:DialogManagerCreate a server links dialog- Specified by:
createServerLinksDialogin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of ServerLinksDialog
-
createNoticeDialog
Description copied from interface:DialogManagerCreate a notice dialog- Specified by:
createNoticeDialogin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of NoticeDialog
-
createDialogListDialog
Description copied from interface:DialogManagerCreate a dialog list dialog- Specified by:
createDialogListDialogin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder> - Returns:
- a new instance of DialogListDialog
-
register
public void register()Description copied from interface:DialogManagerRegister the dialog manager- Specified by:
registerin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder>
-
unregister
public void unregister()Description copied from interface:DialogManagerUnregister the dialog manager- Specified by:
unregisterin 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:DialogManagerUnregister a custom action by its unique identifier.- Specified by:
unregisterCustomActionin 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:DialogManagerUnregister a custom action by its namespace and unique identifier.- Specified by:
unregisterCustomActionin 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:DialogManagerUnregister all custom actions.- Specified by:
unregisterAllCustomActionsin interfaceDialogManager<org.bukkit.inventory.ItemStack,PaperDialogBodyBuilder, PaperDialogInputBuilder, PaperDialog<?>, PaperDialogActionBuilder>
-
registerCustomAction
Description copied from interface:DialogManagerRegister a custom action with a unique identifier.- Specified by:
registerCustomActionin 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 payload
-
registerCustomAction
Description copied from interface:DialogManagerRegister a custom action with a unique identifier.- Specified by:
registerCustomActionin 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 payload
-
clearDialog
Description copied from interface:DialogManagerClear the current dialog associated with the given player UUID.- Specified by:
clearDialogin 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
-