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
ConstructorDescriptionCommandRegisteredEvent
(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 theBukkitBrigadierCommand
for theCommand
being registered.Deprecated.Gets theCommand
being registered.Deprecated.Gets the command label of theCommand
being registered.Deprecated.Gets the Bukkit APIs default arguments node (greedy string), for if you wish to reuse it.static @NotNull HandlerList
Deprecated.Deprecated.com.mojang.brigadier.tree.LiteralCommandNode
<S> Deprecated.Gets theLiteralCommandNode
to be registered for theCommand
.com.mojang.brigadier.tree.RootCommandNode
<S> getRoot()
Deprecated.Gets theRootCommandNode
which is being registered to.boolean
Deprecated.Gets the cancellation state of this event.boolean
Deprecated.Gets whether this command should is treated as "raw".void
setCancelled
(boolean cancel) Deprecated.Cancels registering this command to Brigadier, but will remain in Bukkit Command Map.void
setLiteral
(com.mojang.brigadier.tree.LiteralCommandNode<S> literal) Deprecated.Sets theLiteralCommandNode
used to register this command.void
setRawCommand
(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 theCommand
being registered.- Returns:
- the command label
-
getBrigadierCommand
Deprecated.Gets theBukkitBrigadierCommand
for theCommand
being registered. This can be used as thecommand executor
orSuggestionProvider
of aCommandNode
to delegate to theCommand
being registered.- Returns:
- the
BukkitBrigadierCommand
-
getCommand
Deprecated.Gets theCommand
being registered.- Returns:
- the
Command
-
getRoot
Deprecated.Gets theRootCommandNode
which 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 theLiteralCommandNode
to be registered for theCommand
.- Returns:
- the
LiteralCommandNode
-
setLiteral
Deprecated.Sets theLiteralCommandNode
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 interfaceCancellable
- 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 interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
Deprecated.- Specified by:
getHandlers
in classEvent
-
getHandlerList
Deprecated.
-