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

@Experimental public class AsyncChatDecorateEvent extends ServerEvent implements Cancellable
This event is fired when the server decorates a component for chat purposes. This is called before 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 Also:
  • Constructor Details

  • Method Details

    • player

      @Nullable public @Nullable Player 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

      @NotNull public @NotNull Component originalMessage()
      Gets the original decoration input
      Returns:
      the input
    • result

      @NotNull public @NotNull Component result()
      Gets the decoration result. This may already be different from originalMessage() if some other listener to this event OR the legacy preview event (AsyncPlayerChatPreviewEvent changed the result.
      Returns:
      the result
    • result

      public void result(@NotNull @NotNull Component result)
      Sets the resulting decorated component.
      Parameters:
      result - the result
    • isPreview

      @Deprecated(forRemoval=true) @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.3
      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 interface Cancellable
      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 interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()