Class ChatConfirm
java.lang.Object
com.ultikits.ultitools.widgets.impl.ChatConfirm
- All Implemented Interfaces:
Confirm
A chat-based confirmation dialog implementation.
This widget displays a confirmation prompt in the player's chat with clickable confirm and cancel buttons. Uses Adventure API for rich text formatting.
Example Usage:
Confirm.chat(player, "Delete Item", "Are you sure?",
() -> deleteItem(),
() -> player.sendMessage("Cancelled")
).show();
- Since:
- 6.0.0
- Author:
- wisdomme
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringCustom cancel button text, null uses the default cancel-button i18n key (seegetCancelText())private StringCustom confirm button text, null uses default i18n "OK"private final StringThe description text displayed below titleprivate final RunnableCallback executed when player clicks cancelprivate final RunnableCallback executed when player clicks confirmprivate final org.bukkit.entity.PlayerThe target player to show the dialogprivate final StringThe title text displayed in bold gold -
Constructor Summary
ConstructorsConstructorDescriptionChatConfirm(org.bukkit.entity.Player player, String title, String description, Runnable onConfirm, Runnable onCancel) Creates a chat confirmation dialog with default button text.ChatConfirm(org.bukkit.entity.Player player, String title, String description, String confirmText, String cancelText, Runnable onConfirm, Runnable onCancel) Creates a chat confirmation dialog with custom button text. -
Method Summary
Modifier and TypeMethodDescriptionGet the cancel text.Get the confirm text.voidshow()Show the confirm dialog.
-
Field Details
-
confirmText
Custom confirm button text, null uses default i18n "OK" -
cancelText
Custom cancel button text, null uses the default cancel-button i18n key (seegetCancelText()) -
player
private final org.bukkit.entity.Player playerThe target player to show the dialog -
title
The title text displayed in bold gold -
description
The description text displayed below title -
onConfirm
Callback executed when player clicks confirm -
onCancel
Callback executed when player clicks cancel
-
-
Constructor Details
-
ChatConfirm
public ChatConfirm(org.bukkit.entity.Player player, String title, String description, Runnable onConfirm, Runnable onCancel) Creates a chat confirmation dialog with default button text.- Parameters:
player- the target playertitle- the dialog titledescription- the dialog descriptiononConfirm- callback for confirm actiononCancel- callback for cancel action
-
ChatConfirm
public ChatConfirm(org.bukkit.entity.Player player, String title, String description, String confirmText, String cancelText, Runnable onConfirm, Runnable onCancel) Creates a chat confirmation dialog with custom button text.- Parameters:
player- the target playertitle- the dialog titledescription- the dialog descriptionconfirmText- custom confirm button textcancelText- custom cancel button textonConfirm- callback for confirm actiononCancel- callback for cancel action
-
-
Method Details
-
show
public void show()Show the confirm dialog. Displays the confirmation dialog in player's chat with:- Bold gold title text
- Description text
- Clickable green confirm button
- Clickable red cancel button
-
getConfirmText
Description copied from interface:ConfirmGet the confirm text.- Specified by:
getConfirmTextin interfaceConfirm
-
getCancelText
Description copied from interface:ConfirmGet the cancel text.- Specified by:
getCancelTextin interfaceConfirm
-