Interface ChatProcessor


public interface ChatProcessor
Interface for custom chat processors that can modify, filter, or reroute chat messages. Servers can implement this interface to add custom chat behavior for specific sessions.

Processors are called in registration order and can:

  • Modify message content or formatting
  • Change the target channel
  • Filter messages (deny/cancel)
  • Add custom routing logic

Example usage:

 public class CustomChatProcessor implements ChatProcessor {
     public ChatProcessingResult process(ChatMessage message) {
         // Add custom prefix for spectators
         if (message.channel() == ChatChannel.SPECTATOR) {
             Component newMessage = Component.text("[SPEC] ").append(message.formattedMessage());
             return ChatProcessingResult.allowModified(message.withFormattedMessage(newMessage));
         }
         return ChatProcessingResult.allow(message);
     }
 }
 
Since:
0.9.5
  • Method Details

    • process

      @NotNull @NotNull ChatProcessor.ChatProcessingResult process(@NotNull @NotNull ChatMessage message)
      Processes a chat message and returns the result. This method is called for every message in the associated session.
      Parameters:
      message - the chat message to process (immutable)
      Returns:
      the result of processing, including any modified message