类 ClientChatReceivedEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.ClientChatReceivedEvent
直接已知子类:
ClientChatReceivedEvent.Player, ClientChatReceivedEvent.System

public class ClientChatReceivedEvent extends net.minecraftforge.eventbus.api.Event
Fired when a chat message is received on the client. This can be used for filtering and detecting messages with specific words or phrases, and suppressing them.

This event is cancellable, and does not have a result. If the event is cancelled, the message is not displayed in the chat message window.

This event is fired on the main Forge event bus, only on the logical client.

另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getMessage

      public Component getMessage()
      返回 the message that will be displayed in the chat message window, if the event is not cancelled。
      返回:
      the message that will be displayed in the chat message window, if the event is not cancelled
    • setMessage

      public void setMessage(Component message)
      Sets the new message to be displayed in the chat message window, if the event is not cancelled.
      参数:
      message - the new message to be displayed
    • getBoundChatType

      public ChatType.Bound getBoundChatType()
      返回 the bound chat type of the chat message。. This contains the chat type, display name of the sender, and nullable target name depending on the chat type.
      返回:
      the bound chat type of the chat message
    • getSender

      public UUID getSender()
      返回 the message sender。.
      返回:
      the message sender
    • isSystem

      @Deprecated(forRemoval=true, since="1.21.1") public boolean isSystem()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      返回 true if the message was sent by the system, false otherwise。
      返回:
      true if the message was sent by the system, false otherwise