public class LegacyCommandAdapter extends java.lang.Object implements CommandCallable
Modifier and Type | Method and Description |
---|---|
static LegacyCommandAdapter |
adapt(CommandExecutor<?> executor) |
java.lang.Object |
call(java.lang.String arguments,
CommandLocals locals,
java.lang.String[] parentCommands)
Execute the correct command based on the input.
|
Description |
getDescription()
Get an object describing this command.
|
java.util.List<java.lang.String> |
getSuggestions(java.lang.String arguments,
CommandLocals locals)
Get a list of suggestions based on input.
|
boolean |
testPermission(CommandLocals locals)
Test whether this command can be executed with the given context.
|
public final java.lang.Object call(java.lang.String arguments, CommandLocals locals, java.lang.String[] parentCommands) throws CommandException
CommandCallable
The implementing class must perform the necessary permission checks.
call
in interface CommandCallable
arguments
- the argumentslocals
- the localsparentCommands
- a list of parent commands, with the first most entry being the top-level commandCommandException
- thrown on a command errorpublic Description getDescription()
CommandCallable
getDescription
in interface CommandCallable
public boolean testPermission(CommandLocals locals)
CommandCallable
testPermission
in interface CommandCallable
locals
- the localspublic java.util.List<java.lang.String> getSuggestions(java.lang.String arguments, CommandLocals locals) throws CommandException
CommandCompleter
getSuggestions
in interface CommandCompleter
arguments
- the arguments entered up to this pointlocals
- the localsCommandException
- thrown if there was a parsing errorpublic static LegacyCommandAdapter adapt(CommandExecutor<?> executor)