Class ChatEditor

java.lang.Object
net.joseplay.allianceutils.api.chat.ChatEditor
All Implemented Interfaces:
org.bukkit.event.Listener

public class ChatEditor extends Object implements org.bukkit.event.Listener
Utility listener that allows capturing the next chat message from a player and redirecting it to a custom handler.

Commonly used for chat-based input systems (e.g. menus, editors). When a player is registered, their next message will:

  • Be intercepted
  • Not be sent to public chat
  • Be delivered to the provided Consumer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onChat(org.bukkit.event.player.AsyncPlayerChatEvent event)
    Intercepts chat messages and redirects them if the player is registered.
    static void
    wait(org.bukkit.entity.Player player, Consumer<String> consumer)
    Registers a player to wait for their next chat message.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChatEditor

      public ChatEditor()
  • Method Details

    • wait

      public static void wait(org.bukkit.entity.Player player, Consumer<String> consumer)
      Registers a player to wait for their next chat message.
      Parameters:
      player - the player who will provide input
      consumer - the handler that will receive the message
    • onChat

      public void onChat(org.bukkit.event.player.AsyncPlayerChatEvent event)
      Intercepts chat messages and redirects them if the player is registered.
      Parameters:
      event - the chat event