Class ServerChatEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.ServerChatEvent

public class ServerChatEvent extends net.minecraftforge.eventbus.api.Event
ServerChatEvent is fired whenever a C01PacketChatMessage is processed.
This event is fired via ForgeHooks.onServerChatEvent(ServerGamePacketListenerImpl, String, Component), which is executed by the ServerGamePacketListenerImpl.handleChat(ServerboundChatPacket)

username contains the username of the player sending the chat message.
message contains the message being sent.
player the instance of EntityPlayerMP for the player sending the chat message.
component contains the instance of ChatComponentTranslation for the sent message.

This event is Cancelable.
If this event is canceled, the chat message is never distributed to all clients.

This event does not have a result. Event.HasResult

This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • message

      private final String message
    • filteredMessage

      @Nullable private final String filteredMessage
    • username

      private final String username
    • player

      private final ServerPlayer player
    • component

      @Nullable private Component component
    • filteredComponent

      @Nullable private Component filteredComponent
  • Constructor Details

  • Method Details

    • setComponent

      public void setComponent(Component e)
    • setFilteredComponent

      public void setFilteredComponent(Component e)
    • getComponent

      public Component getComponent()
    • getFilteredComponent

      public Component getFilteredComponent()
    • getMessage

      public String getMessage()
    • getFilteredMessage

      public String getFilteredMessage()
    • getUsername

      public String getUsername()
    • getPlayer

      public ServerPlayer getPlayer()