Class TeamSendMessageEvent

java.lang.Object
org.bukkit.event.Event
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class TeamSendMessageEvent extends TeamPlayerEvent
An event which is called before a message is sent from a TeamPlayer to members of their Team.
  • Constructor Details

    • TeamSendMessageEvent

      public TeamSendMessageEvent(@NotNull @NotNull Team team, @NotNull @NotNull TeamPlayer sender, @NotNull @NotNull String rawMessage, @NotNull @NotNull String proposedFormat, @NotNull @NotNull String senderNamePrefix, @NotNull @NotNull Collection<TeamPlayer> recipients)
      Creates an event with the original data for the message.
      Parameters:
      team - the team which the message is being sent to
      sender - the sender of the message
      rawMessage - the contents of the message being sent (without formatting)
      proposedFormat - the proposed format for the message
      senderNamePrefix - the prefix which will be appended to the sender's name in the formatted message
      recipients - the current recipients of the message
  • Method Details

    • getFormattedMessage

      public String getFormattedMessage()
      Using getFormat() and getRawMessage(), this method will format the raw message and return the formatted message using the current format.
      Returns:
      The formatted message using the current format and raw message.
    • getFormattedSenderName

      public String getFormattedSenderName()
      Returns:
      The name of the sender as it will be displayed in the message format ('[prefix][name]').
      API Note:
      The name of the sender is retrieved using Player.getDisplayName() and can be edited accordingly.
    • getSender

      public TeamPlayer getSender()
      Returns:
      The player sending this message to their team.
      API Note:
      A more readable overload of TeamPlayerEvent.getTeamPlayer().
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getRawMessage

      public String getRawMessage()
    • getFormat

      public String getFormat()
      The format which will be used to format the message.
      API Note:
      {0} is replaced with the player name and {1} is the message
    • getSenderNamePrefix

      public String getSenderNamePrefix()
    • getRecipients

      public Set<TeamPlayer> getRecipients()
      A mutable set of players which are going to receive a copy of the message.
      API Note:
      To change who will receive the message, edit this Set.
    • setRawMessage

      public void setRawMessage(String rawMessage)
    • setFormat

      public void setFormat(String format)
      The format which will be used to format the message.
      API Note:
      {0} is replaced with the player name and {1} is the message
    • setSenderNamePrefix

      public void setSenderNamePrefix(String senderNamePrefix)