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. It can be called
under the following circumstances:
- Previewing: If the client requests a preview response, this event is fired to decorate the component before it is sent back to the client for signing.
- Chat: If the client sends a chat packet without having signed a preview (the client could have previews disabled or they sent the message too quickly) this event is fired to generated the decorated component. Note that when this is the case, the message will show up as modified as the decorated component wasn't signed by the client.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerList
boolean
Gets the cancellation state of this event.boolean
If this decorating is part of a preview request/response.Gets 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 OR the legacy preview event (AsyncPlayerChatPreviewEvent
changed the result.- Returns:
- the result
-
result
Sets the resulting decorated component.- Parameters:
result
- the result
-
isPreview
public boolean isPreview()If 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
-