Class ServerMessageEvents

java.lang.Object
net.fabricmc.fabric.api.message.v1.ServerMessageEvents

public final class ServerMessageEvents extends Object
Contains server-side events triggered when broadcasting messages.
  • Field Details

    • ALLOW_CHAT_MESSAGE

      public static final Event<ServerMessageEvents.AllowChatMessage> ALLOW_CHAT_MESSAGE
      An event triggered when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command. Mods can use this to block the message.

      If a listener returned false, the message will not be broadcast, the remaining listeners will not be called (if any), and CHAT_MESSAGE event will not be triggered.

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

    • ALLOW_GAME_MESSAGE

      public static final Event<ServerMessageEvents.AllowGameMessage> ALLOW_GAME_MESSAGE
      An event triggered when the server broadcasts a game message to all players. Game messages include death messages, join/leave messages, and advancement messages. Mods can use this to block the message.

      If a listener returned false, the message will not be broadcast, the remaining listeners will not be called (if any), and GAME_MESSAGE event will not be triggered.

    • ALLOW_COMMAND_MESSAGE

      public static final Event<ServerMessageEvents.AllowCommandMessage> ALLOW_COMMAND_MESSAGE
      An event triggered 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). Mods can use this to block the message.

      If a listener returned false, the message will not be broadcast, the remaining listeners will not be called (if any), and COMMAND_MESSAGE event will not be triggered.

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

    • CHAT_MESSAGE

      public static final Event<ServerMessageEvents.ChatMessage> CHAT_MESSAGE
      An event triggered when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command. Is not called when chat messages are blocked.

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

    • GAME_MESSAGE

      public static final Event<ServerMessageEvents.GameMessage> GAME_MESSAGE
      An event triggered when the server broadcasts a game message to all players. Game messages include death messages, join/leave messages, and advancement messages. Is not called when game messages are blocked.
    • COMMAND_MESSAGE

      public static final Event<ServerMessageEvents.CommandMessage> COMMAND_MESSAGE
      An event triggered 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). Is not called when command messages are blocked.

      If the command is executed by a player, ALLOW_CHAT_MESSAGE and CHAT_MESSAGE events will also be triggered after this event.