Package io.papermc.paper.event.player

# Class AbstractChatEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.AbstractChatEvent

All Implemented Interfaces:
  `Cancellable`

Direct Known Subclasses:
  `AsyncChatEvent`, `ChatEvent`

public abstract class AbstractChatEvent extends PlayerEvent implements Cancellable
An abstract implementation of a chat event, handling shared logic.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.bukkit.event.Event

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.player.PlayerEvent

`player`

## Method Summary

Modifier and Type
Method
Description
`final boolean`
`isCancelled()`
Gets the cancellation state of this event.
`final @NotNull Component`
`message()`
Gets the user-supplied message.
`final void`
`message(@NotNull Component message)`
Sets the user-supplied message.
`final @NotNull Component`
`originalMessage()`
Gets the original and unmodified user-supplied message.
`final @NotNull ChatRenderer`
`renderer()`
Gets the chat renderer.
`final void`
`renderer(@NotNull ChatRenderer renderer)`
Sets the chat renderer.
`final void`
`setCancelled(boolean cancelled)`
Sets the cancellation state of this event.
`final @NotNull Set<Audience>`
`viewers()`
Gets a set of `audiences` that this chat message will be displayed to.

### Methods inherited from class org.bukkit.event.player.PlayerEvent

`getPlayer`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, getHandlers, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### viewers

@NotNull public final @NotNull Set<Audience> viewers()
Gets a set of `audiences` that this chat message will be displayed to.

The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.

Listeners should be aware that modifying the list may throw `UnsupportedOperationException` if the event caller provides an unmodifiable set.

Returns:
  a set of `audiences` who will receive the chat message

### renderer

public final void renderer(@NotNull @NotNull ChatRenderer renderer)
Sets the chat renderer.

Parameters:
  `renderer` - the chat renderer
Throws:
  `NullPointerException` - if `renderer` is `null`

### renderer

@NotNull public final @NotNull ChatRenderer renderer()
Gets the chat renderer.

Returns:
  the chat renderer

### message

@NotNull public final @NotNull Component message()
Gets the user-supplied message. The return value will reflect changes made using `message(Component)`.

Returns:
  the user-supplied message

### message

public final void message(@NotNull @NotNull Component message)
Sets the user-supplied message.

Parameters:
  `message` - the user-supplied message
Throws:
  `NullPointerException` - if `message` is `null`

### originalMessage

@NotNull public final @NotNull Component originalMessage()
Gets the original and unmodified user-supplied message. The return value will not reflect changes made using `message(Component)`.

Returns:
  the original user-supplied message

### isCancelled

public final boolean isCancelled()
Description copied from interface: `Cancellable`
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Specified by:
  `isCancelled` in interface `Cancellable`
Returns:
  true if this event is cancelled

### setCancelled

public final void setCancelled(boolean cancelled)
Description copied from interface: `Cancellable`
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Specified by:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancelled` - true if you wish to cancel this event