Package com.velocitypowered.api.command
Interface Command
-
- All Known Subinterfaces:
InvocableCommand<I>
,RawCommand
,SimpleCommand
- All Known Implementing Classes:
BrigadierCommand
public interface Command
Represents a command that can be executed by aCommandSource
such as aPlayer
or the console.Velocity 1.1.0 introduces specialized command subinterfaces to separate command parsing concerns. These include, in order of preference:
BrigadierCommand
, which supports parameterized arguments and specialized execution, tab complete suggestions and permission-checking logic.SimpleCommand
, modelled after the convention popularized by Bukkit and BungeeCord. Older classes directly implementingCommand
are suggested to migrate to this interface.RawCommand
, useful for bolting on external command frameworks to Velocity.
For this reason, the legacy
execute
,suggest
andhasPermission
methods are deprecated and will be removed in Velocity 2.0.0. We suggest implementing one of the more specific subinterfaces instead. The legacy methods are executed by aCommandManager
if and only if the given command directly implements this interface.
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
execute(CommandSource source, String @NonNull [] args)
Deprecated.seeCommand
default boolean
hasPermission(CommandSource source, String @NonNull [] args)
Deprecated.seeCommand
default List<String>
suggest(CommandSource source, String @NonNull [] currentArgs)
Deprecated.seeCommand
default CompletableFuture<List<String>>
suggestAsync(CommandSource source, String @NonNull [] currentArgs)
Deprecated.seeCommand
-
-
-
Method Detail
-
execute
@Deprecated default void execute(CommandSource source, String @NonNull [] args)
Deprecated.seeCommand
Executes the command for the specified source.- Parameters:
source
- the source to execute the command forargs
- the arguments for the command
-
suggest
@Deprecated default List<String> suggest(CommandSource source, String @NonNull [] currentArgs)
Deprecated.seeCommand
Provides tab complete suggestions for the specified source.- Parameters:
source
- the source to execute the command forcurrentArgs
- the partial arguments for the command- Returns:
- the tab complete suggestions
-
suggestAsync
@Deprecated default CompletableFuture<List<String>> suggestAsync(CommandSource source, String @NonNull [] currentArgs)
Deprecated.seeCommand
Provides tab complete suggestions for the specified source.- Parameters:
source
- the source to execute the command forcurrentArgs
- the partial arguments for the command- Returns:
- the tab complete suggestions
-
hasPermission
@Deprecated default boolean hasPermission(CommandSource source, String @NonNull [] args)
Deprecated.seeCommand
Tests to check if the source has permission to perform the command with the provided arguments.- Parameters:
source
- the source to execute the command forargs
- the arguments for the command- Returns:
true
if the source has permission
-
-