Package com.velocitypowered.api.command
Interface InvocableCommand<I extends CommandInvocation<?>>
- Type Parameters:
I
- the type of the command invocation object
- All Superinterfaces:
Command
- All Known Subinterfaces:
RawCommand
,SimpleCommand
public sealed interface InvocableCommand<I extends CommandInvocation<?>>
extends Command
permits RawCommand, SimpleCommand
A command that can be executed with arbitrary arguments.
Modifying the command tree (e.g. registering a command via
CommandManager.register(CommandMeta, Command)
) during
permission checking and suggestions provision results in
undefined behavior, which may include deadlocks.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes the command for the specified invocation.default boolean
hasPermission
(I invocation) Tests to check if the source has permission to perform the specified invocation.Provides tab complete suggestions for the specified invocation.default CompletableFuture<List<String>>
suggestAsync
(I invocation) Provides tab complete suggestions for the specified invocation.
-
Method Details
-
execute
Executes the command for the specified invocation.- Parameters:
invocation
- the invocation context
-
suggest
Provides tab complete suggestions for the specified invocation.- Parameters:
invocation
- the invocation context- Returns:
- the tab complete suggestions
-
suggestAsync
Provides tab complete suggestions for the specified invocation.- Parameters:
invocation
- the invocation context- Returns:
- the tab complete suggestions
- Implementation Requirements:
- defaults to wrapping the value returned by
suggest(CommandInvocation)
-
hasPermission
Tests to check if the source has permission to perform the specified invocation.If the method returns
false
, the handling is forwarded onto the players current server.- Parameters:
invocation
- the invocation context- Returns:
true
if the source has permission
-