java.lang.Object
tech.guilhermekaua.spigotboot.core.spigot.conversation.ChatUtils

public final class ChatUtils extends Object
Entry point for temporary server-to-player chat conversations.

 ChatUtils.with(player)
     .firstPrompt("#ffaa00Enter an amount, &7or type &ccancel")
     .timeout(30, TimeUnit.SECONDS)
     .onTimeout(p -> p.sendMessage("Timed out."))
     .onChat(ctx -> {
         if (ctx.getMessage().equalsIgnoreCase("cancel")) { ctx.end(); return; }
         // ... handle input; call ctx.end() when done, or leave active to re-prompt
     });
 

Backed by an internal @Component installed when the spigot-boot context becomes ready. Calling with(Player) before that point throws IllegalStateException.

  • Method Details

    • with

      @NotNull public static @NotNull ChatPrompt with(@NotNull @NotNull org.bukkit.entity.Player player)
      Parameters:
      player - the player to converse with
      Returns:
      a fluent builder for the conversation
      Throws:
      IllegalStateException - if the spigot-boot context is not ready yet
    • onChat

      public static void onChat(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Consumer<ChatContext> callback)
      Shorthand for with(player).onChat(callback) with no options.
      Parameters:
      player - the player to converse with
      callback - invoked for each captured message