Class ChatEvent

java.lang.Object
org.bukkit.event.Event
net.essentialsx.api.v2.events.chat.ChatEvent
All Implemented Interfaces:
Cancellable
Direct Known Subclasses:
GlobalChatEvent, LocalChatEvent, LocalChatSpyEvent

public abstract class ChatEvent extends Event implements Cancellable
This handles common boilerplate for other ChatEvents
  • Constructor Details

  • Method Details

    • getMessage

      public String getMessage()
      Gets the message that the player is attempting to send. This message will be used with getFormat().
      Returns:
      Message the player is attempting to send
    • setMessage

      public void setMessage(String message)
      Sets the message that the player will send. This message will be used with getFormat().
      Parameters:
      message - New message that the player will send
    • getFormat

      public String getFormat()
      Gets the format to use to display this chat message. When this event finishes execution, the first format parameter is the Player.getDisplayName() and the second parameter is getMessage()
      Returns:
      String.format(String, Object...) compatible format string
    • setFormat

      public void setFormat(String format) throws IllegalFormatException, NullPointerException
      Sets the format to use to display this chat message. When this event finishes execution, the first format parameter is the Player.getDisplayName() and the second parameter is getMessage()
      Parameters:
      format - String.format(String, Object...) compatible format string
      Throws:
      IllegalFormatException - if the underlying API throws the exception
      NullPointerException - if format is null
      See Also:
    • getRecipients

      public Set<Player> getRecipients()
      Gets a set of recipients that this chat message will be displayed to.
      Returns:
      All Players who will see this chat message
    • getPlayer

      public final Player getPlayer()
      Returns the player involved in this event
      Returns:
      Player who is involved in this event
    • getChatType

      public ChatType getChatType()
      Returns the type of chat this event is fired for
      Returns:
      Type of chat this event is fired for
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Cancellable
    • setCancelled

      public void setCancelled(boolean cancel)
      Specified by:
      setCancelled in interface Cancellable