Class PlayerChatEvent

java.lang.Object
com.hypixel.hytale.server.core.event.events.player.PlayerChatEvent
All Implemented Interfaces:
IAsyncEvent<String>, IBaseEvent<String>, ICancellable

public class PlayerChatEvent extends Object implements IAsyncEvent<String>, ICancellable
A player event called when a player sends a chat message.
  • Field Details

    • DEFAULT_FORMATTER

      @Nonnull public static final PlayerChatEvent.Formatter DEFAULT_FORMATTER
      The default message formatter for player messages.
  • Constructor Details

    • PlayerChatEvent

      public PlayerChatEvent(@Nonnull PlayerRef sender, @Nonnull List<PlayerRef> targets, @Nonnull String content)
      Default Constructor for a PlayerChatEvent instance.
      Parameters:
      targets - The list of players to receive the chat message.
      content - The content of the chat message from the player.
  • Method Details

    • getSender

      @Nonnull public PlayerRef getSender()
      Returns:
      the player that sent the message.
    • setSender

      public void setSender(@Nonnull PlayerRef sender)
      Called to set the player that sent the message.
      Parameters:
      sender - The player that sent the message.
    • getTargets

      @Nonnull public List<PlayerRef> getTargets()
      Returns:
      the list of target players that will receive the message.
    • setTargets

      public void setTargets(@Nonnull List<PlayerRef> targets)
      Called to set the list of target players that will receive the message.
      Parameters:
      targets - The list of target players to set.
    • getContent

      @Nonnull public String getContent()
      Returns:
      the Message to be sent.
    • setContent

      public void setContent(@Nonnull String content)
      Called to set the message that is to be sent.
      Parameters:
      content - The Message to set.
    • getFormatter

      @Nonnull public PlayerChatEvent.Formatter getFormatter()
      Returns:
      the formatter to be applied to the players message.
    • setFormatter

      public void setFormatter(@Nonnull PlayerChatEvent.Formatter formatter)
      Called to set the formatter to be applied to the players message.
      Parameters:
      formatter - The formatter to be set.
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: ICancellable
      Determines whether this event has been cancelled.
      Specified by:
      isCancelled in interface ICancellable
      Returns:
      true if the event has been cancelled, false otherwise.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: ICancellable
      Called to set whether this event is cancelled.
      Specified by:
      setCancelled in interface ICancellable
      Parameters:
      cancelled - true to cancel the event, false to uncancel it.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object