Interface ServerMessageEvents.AllowChatMessage

Enclosing class:
ServerMessageEvents
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface ServerMessageEvents.AllowChatMessage
  • Method Details

    • allowChatMessage

      boolean allowChatMessage(SignedMessage message, ServerPlayerEntity sender, MessageType.Parameters params)
      Called when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command. Returning false prevents the message body from being broadcast and the ServerMessageEvents.CHAT_MESSAGE event from triggering. However, the header (which includes the sender profile) will always be sent.

      If the message is from a player-executed command, this will be called only if ServerMessageEvents.ALLOW_COMMAND_MESSAGE event did not block the message body, and after triggering ServerMessageEvents.COMMAND_MESSAGE event.

      Parameters:
      message - the broadcast message with message decorators applied; use message.getContent() to get the text
      sender - the player that sent the message
      params - the MessageType.Parameters
      Returns:
      true if the message body should be broadcast, otherwise false