Class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource>

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.server.ServerEvent
com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent<S>
All Implemented Interfaces:
Cancellable

@Experimental @Deprecated(since="1.20.6") public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable
Deprecated.
For removal, use the new brigadier api.
Fired anytime the server synchronizes Bukkit commands to Brigadier.

Allows a plugin to control the command node structure for its commands. This is done at Plugin Enable time after commands have been registered, but may also run at a later point in the server lifetime due to plugins, a server reload, etc.

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

  • Constructor Details

    • CommandRegisteredEvent

      public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, com.mojang.brigadier.tree.RootCommandNode<S> root, com.mojang.brigadier.tree.LiteralCommandNode<S> literal, com.mojang.brigadier.tree.ArgumentCommandNode<S,String> defaultArgs)
      Deprecated.
  • Method Details

    • getCommandLabel

      public String getCommandLabel()
      Deprecated.
      Gets the command label of the Command being registered.
      Returns:
      the command label
    • getBrigadierCommand

      public BukkitBrigadierCommand<S> getBrigadierCommand()
      Deprecated.
      Gets the BukkitBrigadierCommand for the Command being registered. This can be used as the command executor or SuggestionProvider of a CommandNode to delegate to the Command being registered.
      Returns:
      the BukkitBrigadierCommand
    • getCommand

      public Command getCommand()
      Deprecated.
      Gets the Command being registered.
      Returns:
      the Command
    • getRoot

      public com.mojang.brigadier.tree.RootCommandNode<S> getRoot()
      Deprecated.
      Gets the RootCommandNode which is being registered to.
      Returns:
      the RootCommandNode
    • getDefaultArgs

      public com.mojang.brigadier.tree.ArgumentCommandNode<S,String> getDefaultArgs()
      Deprecated.
      Gets the Bukkit APIs default arguments node (greedy string), for if you wish to reuse it.
      Returns:
      default arguments node
    • getLiteral

      public com.mojang.brigadier.tree.LiteralCommandNode<S> getLiteral()
      Deprecated.
      Gets the LiteralCommandNode to be registered for the Command.
      Returns:
      the LiteralCommandNode
    • setLiteral

      public void setLiteral(com.mojang.brigadier.tree.LiteralCommandNode<S> literal)
      Deprecated.
      Sets the LiteralCommandNode used to register this command. The default literal is mutable, so this is primarily if you want to completely replace the object.
      Parameters:
      literal - new node
    • isRawCommand

      public boolean isRawCommand()
      Deprecated.
      Gets whether this command should is treated as "raw".
      Returns:
      whether this command is treated as "raw"
      See Also:
    • setRawCommand

      public void setRawCommand(boolean rawCommand)
      Deprecated.
      Sets whether this command should be treated as "raw".

      A "raw" command will only use the node provided by this event for sending the command tree to the client. For execution purposes, the default greedy string execution of a standard Bukkit Command is used.

      On older versions of Paper, this was the default and only behavior of this event.

      Parameters:
      rawCommand - whether this command should be treated as "raw"
    • isCancelled

      public boolean isCancelled()
      Deprecated.
      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)
      Deprecated.
      Cancels registering this command to Brigadier, but will remain in Bukkit Command Map. Can be used to hide a command from all players. 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 interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

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

      @NotNull public static @NotNull HandlerList getHandlerList()
      Deprecated.