Class PlayerChatEvent.ChatResult

java.lang.Object
com.velocitypowered.api.event.player.PlayerChatEvent.ChatResult
All Implemented Interfaces:
ResultedEvent.Result
Enclosing class:
PlayerChatEvent

public static final class PlayerChatEvent.ChatResult extends Object implements ResultedEvent.Result
Represents the result of the PlayerChatEvent.
  • Method Details

    • getMessage

      public Optional<String> getMessage()
    • isAllowed

      public boolean isAllowed()
      Description copied from interface: ResultedEvent.Result
      Returns whether or not the event is allowed to proceed. Plugins may choose to skip denied events, and the proxy will respect the result of this method.
      Specified by:
      isAllowed in interface ResultedEvent.Result
      Returns:
      whether or not the event is allowed to proceed
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • allowed

      public static PlayerChatEvent.ChatResult allowed()
      Allows the message to be sent, without modification.
      Returns:
      the allowed result
    • denied

      public static PlayerChatEvent.ChatResult denied()
      Prevents the message from being sent.
      Returns:
      the denied result
    • message

      public static PlayerChatEvent.ChatResult message(@NonNull String message)
      Allows the message to be sent, but silently replaced with another.
      Parameters:
      message - the message to use instead
      Returns:
      a result with a new message