Class PlayerChatEvent

java.lang.Object
me.internalizable.numdrassl.api.event.player.PlayerChatEvent
All Implemented Interfaces:
Cancellable

public class PlayerChatEvent extends Object implements Cancellable
Event fired when a player sends a chat message. This is fired BEFORE the message is sent to the server.

This event is cancellable. If cancelled, the chat message will not be sent.

  • Constructor Details

    • PlayerChatEvent

      public PlayerChatEvent(@Nonnull Player player, @Nonnull String message)
  • Method Details

    • getPlayer

      @Nonnull public Player getPlayer()
      Get the player who sent the message.
      Returns:
      the player
    • getMessage

      @Nonnull public String getMessage()
      Get the chat message.
      Returns:
      the message
    • setMessage

      public void setMessage(@Nonnull String message)
      Set the chat message. This allows plugins to modify the message before it's sent.
      Parameters:
      message - the new message
    • isCommand

      public boolean isCommand()
      Check if this is a command (starts with /).
      Returns:
      true if this is a command
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Check if this event has been cancelled.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the event is cancelled
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Set whether this event is cancelled.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to cancel the event