Class ChatConfirm

java.lang.Object
com.ultikits.ultitools.widgets.impl.ChatConfirm
All Implemented Interfaces:
Confirm

public class ChatConfirm extends Object implements 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 Details

    • confirmText

      private String confirmText
      Custom confirm button text, null uses default i18n "OK"
    • cancelText

      private String cancelText
      Custom cancel button text, null uses the default cancel-button i18n key (see getCancelText())
    • player

      private final org.bukkit.entity.Player player
      The target player to show the dialog
    • title

      private final String title
      The title text displayed in bold gold
    • description

      private final String description
      The description text displayed below title
    • onConfirm

      private final Runnable onConfirm
      Callback executed when player clicks confirm
    • onCancel

      private final Runnable 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 player
      title - the dialog title
      description - the dialog description
      onConfirm - callback for confirm action
      onCancel - 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 player
      title - the dialog title
      description - the dialog description
      confirmText - custom confirm button text
      cancelText - custom cancel button text
      onConfirm - callback for confirm action
      onCancel - 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
      Specified by:
      show in interface Confirm
    • getConfirmText

      public String getConfirmText()
      Description copied from interface: Confirm
      Get the confirm text.
      Specified by:
      getConfirmText in interface Confirm
    • getCancelText

      public String getCancelText()
      Description copied from interface: Confirm
      Get the cancel text.
      Specified by:
      getCancelText in interface Confirm