Class AsyncPlayerSendCommandsEvent<S extends BukkitBrigadierCommandSource>

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<S>

@Experimental public class AsyncPlayerSendCommandsEvent<S extends BukkitBrigadierCommandSource> extends org.bukkit.event.player.PlayerEvent
Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands. You may manipulate this CommandNode to change what the client sees.

This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.

This event will fire before PlayerCommandSendEvent, so no filtering has been done by other plugins yet.

WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync. It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once. If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.

Your logic should look like this: if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }

If your logic is not safe to run asynchronously, only react to the synchronous version.

This is a draft/experimental API and is subject to change.

  • Nested Class Summary

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

    org.bukkit.event.Event.Result
  • Field Summary

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

    player
  • Constructor Summary

    Constructors
    Constructor
    Description
    AsyncPlayerSendCommandsEvent(org.bukkit.entity.Player player, com.mojang.brigadier.tree.RootCommandNode<S> node, boolean hasFiredAsync)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.brigadier.tree.RootCommandNode<S>
    Gets the full Root Command Node being sent to the client, which is mutable.
    static @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
     
    boolean
    Gets if this event has already fired asynchronously.

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

    getPlayer

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AsyncPlayerSendCommandsEvent

      public AsyncPlayerSendCommandsEvent(org.bukkit.entity.Player player, com.mojang.brigadier.tree.RootCommandNode<S> node, boolean hasFiredAsync)
  • Method Details

    • getCommandNode

      public com.mojang.brigadier.tree.RootCommandNode<S> getCommandNode()
      Gets the full Root Command Node being sent to the client, which is mutable.
      Returns:
      the root command node
    • hasFiredAsync

      public boolean hasFiredAsync()
      Gets if this event has already fired asynchronously.
      Returns:
      whether this event has already fired asynchronously
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()