Interface ServerMessageEvents.AllowCommandMessage

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.AllowCommandMessage
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    allowCommandMessage(net.minecraft.network.chat.PlayerChatMessage message, net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.ChatType.Bound boundChatType)
    Called when the server broadcasts a command message to all players, such as one from /me and /say (but not ones that specify the recipients like /msg).
  • Method Details

    • allowCommandMessage

      boolean allowCommandMessage(net.minecraft.network.chat.PlayerChatMessage message, net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.ChatType.Bound boundChatType)
      Called when the server broadcasts a command message to all players, such as one from /me and /say (but not ones that specify the recipients like /msg). Returning false prevents the message from being broadcast and the ServerMessageEvents.COMMAND_MESSAGE event from triggering.

      If the command is executed by a player and the message is not blocked, ServerMessageEvents.ALLOW_CHAT_MESSAGE and ServerMessageEvents.CHAT_MESSAGE events will also be triggered after triggering ServerMessageEvents.COMMAND_MESSAGE.

      Parameters:
      message - the broadcast message with chat decorators applied if applicable; use message.decoratedContent() to get the component
      source - the command source that sent the message
      boundChatType - the ChatType.Bound
      Returns:
      true if the message should be broadcast, otherwise false