Class PlayerChatEvent

java.lang.Object
fr.fidorial.event.player.PlayerChatEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent
Direct Known Subclasses:
PlayerSignedChatEvent

public class PlayerChatEvent extends Object implements PlayerEvent, Cancellable
Fired when a player sends a chat message, before it is broadcast.

Cancelling the event drops the message.

Since:
0.1.0
See Also:
  • Constructor Details

    • PlayerChatEvent

      public PlayerChatEvent(Player player, Component message)
      Creates an event.
      Parameters:
      player - the player who sent the message
      message - the message about to be broadcast
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • message

      public Component message()
      Returns the message about to be broadcast, possibly replaced by a previous listener.
      Returns:
      the message about to be broadcast, possibly replaced by a previous listener
      Since:
      0.1.0
    • setMessage

      public void setMessage(Component message)
      Replaces the message about to be broadcast.
      Parameters:
      message - the message to broadcast instead
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it