Interface PlayerChatEvent.Submit

All Superinterfaces:
Cancellable, Event, MessageEvent, PlayerChatEvent
Enclosing interface:
PlayerChatEvent

public static interface PlayerChatEvent.Submit extends PlayerChatEvent, Cancellable
Fired when a message is sent by a player.

Note that a signed message cannot be modified.

  • Method Details

    • filter

      Returns the predicate for filtering the players receiving the message if set.
      Returns:
      the predicate
    • setFilter

      void setFilter(Predicate<ServerPlayer> filter)
      Sets the predicate for filtering the players receiving the message.
      Parameters:
      filter - the predicate
    • sender

      Component sender()
      Returns the component to use as the sender. In Vanilla this defaults to the players display name
      Returns:
      The sender component
    • setSender

      void setSender(Component sender)
      Sets the component to use as the sender.
      Parameters:
      sender - The sender component
    • target

      Optional<Component> target()
      Returns the component to use as the target.
      Returns:
      The target component
    • setTarget

      void setTarget(Component target)
      Sets the component to use as the target.
      Parameters:
      target - The target component
    • chatType

      Returns the chat type used.
      Returns:
      The chat type
    • setChatType

      void setChatType(RegistryReference<ChatType> chatType)
      Sets the chat type. To control the full message format use one of ChatTypes.CUSTOM_CHAT or ChatTypes.CUSTOM_MESSAGE

      To modify the chat message itself it is recommended to use PlayerChatEvent.Decorate.

      Parameters:
      chatType - the chat type to use.
    • isSigned

      boolean isSigned()
      Returns true when MessageEvent.originalMessage() is signed and cannot be modified.
      Returns:
      True when signed