Package io.papermc.paper.event.player
Class AsyncChatDecorateEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.server.ServerEvent
io.papermc.paper.event.player.AsyncChatDecorateEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
AsyncChatCommandDecorateEvent
This event is fired when the server decorates a component for chat purposes. This is called
before
See
AsyncChatEvent
and the other chat events. It is recommended that you modify the
message here, and use the chat events for modifying receivers and later the chat type. If you
want to keep the message as "signed" for the clients who get it, be sure to include the entire
original message somewhere in the final message.
See
AsyncChatCommandDecorateEvent
for the decoration of messages sent via commands-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionAsyncChatDecorateEvent
(@Nullable Player player, @NotNull Component originalMessage) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerList
boolean
Gets the cancellation state of this event.boolean
Deprecated, for removal: This API element is subject to removal in a future version.chat preview was removed in 1.19.3Gets the original decoration inputplayer()
Gets the player (if available) associated with this event.result()
Gets the decoration result.void
Sets the resulting decorated component.void
setCancelled
(boolean cancel) A cancelled decorating event means that no changes to the result component will have any effect.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
AsyncChatDecorateEvent
-
-
Method Details
-
player
Gets the player (if available) associated with this event.Certain commands request decorations without a player context which is why this is possibly null.
- Returns:
- the player or
null
-
originalMessage
Gets the original decoration input- Returns:
- the input
-
result
Gets the decoration result. This may already be different fromoriginalMessage()
if some other listener to this event changed the result.- Returns:
- the result
-
result
Sets the resulting decorated component.- Parameters:
result
- the result
-
isPreview
@Deprecated(forRemoval=true, since="1.19.3") @ScheduledForRemoval(inVersion="1.21") @Contract(value="-> false", pure=true) public boolean isPreview()Deprecated, for removal: This API element is subject to removal in a future version.chat preview was removed in 1.19.3If this decorating is part of a preview request/response.- Returns:
true
if part of previewing
-
isCancelled
public 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 void setCancelled(boolean cancel) A cancelled decorating event means that no changes to the result component will have any effect. The decorated component will be equal to the original component.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-