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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionCommandRegisteredEvent(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 Summary
Modifier and TypeMethodDescriptionDeprecated.Gets theBukkitBrigadierCommandfor theCommandbeing registered.Deprecated.Gets theCommandbeing registered.Deprecated.Gets the command label of theCommandbeing registered.Deprecated.Gets the Bukkit APIs default arguments node (greedy string), for if you wish to reuse it.static @NotNull HandlerListDeprecated.Deprecated.com.mojang.brigadier.tree.LiteralCommandNode<S> Deprecated.Gets theLiteralCommandNodeto be registered for theCommand.com.mojang.brigadier.tree.RootCommandNode<S> getRoot()Deprecated.Gets theRootCommandNodewhich is being registered to.booleanDeprecated.Gets the cancellation state of this event.booleanDeprecated.Gets whether this command should is treated as "raw".voidsetCancelled(boolean cancel) Deprecated.Cancels registering this command to Brigadier, but will remain in Bukkit Command Map.voidsetLiteral(com.mojang.brigadier.tree.LiteralCommandNode<S> literal) Deprecated.Sets theLiteralCommandNodeused to register this command.voidsetRawCommand(boolean rawCommand) Deprecated.Sets whether this command should be treated as "raw".Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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
Deprecated.Gets the command label of theCommandbeing registered.- Returns:
- the command label
-
getBrigadierCommand
Deprecated.Gets theBukkitBrigadierCommandfor theCommandbeing registered. This can be used as thecommand executororSuggestionProviderof aCommandNodeto delegate to theCommandbeing registered.- Returns:
- the
BukkitBrigadierCommand
-
getCommand
Deprecated.Gets theCommandbeing registered.- Returns:
- the
Command
-
getRoot
Deprecated.Gets theRootCommandNodewhich is being registered to.- Returns:
- the
RootCommandNode
-
getDefaultArgs
Deprecated.Gets the Bukkit APIs default arguments node (greedy string), for if you wish to reuse it.- Returns:
- default arguments node
-
getLiteral
Deprecated.Gets theLiteralCommandNodeto be registered for theCommand.- Returns:
- the
LiteralCommandNode
-
setLiteral
Deprecated.Sets theLiteralCommandNodeused 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
Commandis 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:
isCancelledin interfaceCancellable- Returns:
trueif 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:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
Deprecated.- Specified by:
getHandlersin classEvent
-
getHandlerList
Deprecated.
-