类 ServerChatEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.ServerChatEvent
所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent

public class ServerChatEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.ICancellableEvent
This event is fired whenever a ServerboundChatPacket is received from a client who has submitted their chat message.

This event is cancellable, and does not

引用无效
have a result
. If the event is cancelled, the message will not be sent to clients.

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

  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getPlayer

      public ServerPlayer getPlayer()
      返回 the player who initiated the chat action。
      返回:
      the player who initiated the chat action
    • getUsername

      public String getUsername()
      返回 the username of the player who initiated the chat action。
      返回:
      the username of the player who initiated the chat action
    • getRawText

      public String getRawText()
      返回 the original raw text of the player chat message。
      返回:
      the original raw text of the player chat message
    • setMessage

      public void setMessage(Component message)
      Set the message to be sent to the relevant clients.
    • getMessage

      public Component getMessage()
      返回 the message that will be sent to the relevant clients, if the event is not cancelled。
      返回:
      the message that will be sent to the relevant clients, if the event is not cancelled