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
@NonExtendable
@NullMarked
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 TypeMethodDescriptionfinal boolean
Gets the cancellation state of this event.final Component
message()
Gets the user-supplied message.final void
Sets the user-supplied message.final Component
Gets the original and unmodified user-supplied message.final ChatRenderer
renderer()
Gets the chat renderer.final void
renderer
(ChatRenderer renderer) Sets the chat renderer.final void
setCancelled
(boolean cancel) Sets the cancellation state of this event.final SignedMessage
Gets the signed message.viewers()
Gets a set ofaudiences
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
-
Method Details
-
viewers
Gets a set ofaudiences
that this chat message will be displayed to.The set returned may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
- Returns:
- a mutable set of
audiences
who will receive the chat message
-
renderer
Sets the chat renderer.- Parameters:
renderer
- the chat renderer- Throws:
NullPointerException
- ifrenderer
isnull
-
renderer
Gets the chat renderer.- Returns:
- the chat renderer
-
message
Gets the user-supplied message. The return value will reflect changes made usingmessage(Component)
.- Returns:
- the user-supplied message
-
message
Sets the user-supplied message.- Parameters:
message
- the user-supplied message- Throws:
NullPointerException
- ifmessage
isnull
-
originalMessage
Gets the original and unmodified user-supplied message. The return value will not reflect changes made usingmessage(Component)
.- Returns:
- the original user-supplied message
-
signedMessage
Gets the signed message. Changes made in this event will not update the signed message.- Returns:
- the signed 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 interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public final void setCancelled(boolean cancel) 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 interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-