Interface DialogService

All Superinterfaces:
Listener, ServiceContainer

public interface DialogService extends ServiceContainer
Opens text and confirm prompts for a viewer using whichever transport the implementation has available (anvil rename, chat conversation, or a chest-menu confirm). Callbacks fire on the main thread.
  • Method Details

    • promptText

      void promptText(Player viewer, TextPromptSpec spec, Consumer<String> onResult, Runnable onCancel)
      Opens a text-input prompt. Calls onResult with the submitted text, or onCancel if dismissed.
      Parameters:
      viewer - who to show the prompt to
      spec - what the prompt looks like and how long the input may be
      onResult - receives the submitted text, on the main thread
      onCancel - run if the viewer dismisses the prompt, on the main thread
    • promptConfirm

      void promptConfirm(Player viewer, ConfirmPromptSpec spec, Runnable onYes, Runnable onNo)
      Opens a yes/no confirm prompt. Calls onYes on confirm and onNo on cancel/decline.
      Parameters:
      viewer - who to show the prompt to
      spec - the title, message and button labels
      onYes - run if the viewer confirms, on the main thread
      onNo - run if the viewer declines or dismisses, on the main thread