PluginIdentifiableCommand
public final class PluginCommand extends Command implements PluginIdentifiableCommand
Command
belonging to a plugindescription, timings, usageMessage
Modifier | Constructor | Description |
---|---|---|
protected |
PluginCommand(@NotNull String name,
@NotNull Plugin owner) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
execute(@NotNull CommandSender sender,
@NotNull String commandLabel,
@NotNull String[] args) |
Executes the command, returning its success
|
@NotNull CommandExecutor |
getExecutor() |
Gets the
CommandExecutor associated with this command |
@NotNull Plugin |
getPlugin() |
Gets the owner of this PluginCommand
|
@Nullable TabCompleter |
getTabCompleter() |
Gets the
TabCompleter associated with this command. |
void |
setExecutor(@Nullable CommandExecutor executor) |
Sets the
CommandExecutor to run when parsing this command |
void |
setTabCompleter(@Nullable TabCompleter completer) |
Sets the
TabCompleter to run when tab-completing this command. |
List<String> |
tabComplete(@NotNull CommandSender sender,
@NotNull String alias,
@NotNull String[] args) |
Executed on tab completion for this command, returning a list of
options the player can tab through.
|
String |
toString() |
broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getTimingName, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, unregister
public boolean execute(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String commandLabel, @NotNull @NotNull String[] args)
public void setExecutor(@Nullable @Nullable CommandExecutor executor)
CommandExecutor
to run when parsing this commandexecutor
- New executor to run@NotNull public @NotNull CommandExecutor getExecutor()
CommandExecutor
associated with this commandpublic void setTabCompleter(@Nullable @Nullable TabCompleter completer)
TabCompleter
to run when tab-completing this command.
If no TabCompleter is specified, and the command's executor implements TabCompleter, then the executor will be used for tab completion.
completer
- New tab completer@Nullable public @Nullable TabCompleter getTabCompleter()
TabCompleter
associated with this command.@NotNull public @NotNull Plugin getPlugin()
getPlugin
in interface PluginIdentifiableCommand
@NotNull public List<String> tabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) throws CommandException, IllegalArgumentException
Delegates to the tab completer if present.
If it is not present or returns null, will delegate to the current
command executor if it implements TabCompleter
. If a non-null
list has not been found, will default to standard player name
completion in Command.tabComplete(CommandSender, String, String[])
.
This method does not consider permissions.
tabComplete
in class Command
sender
- Source object which is executing this commandalias
- the alias being usedargs
- All arguments passed to the command, split via ' 'CommandException
- if the completer or executor throw an
exception during the process of tab-completing.IllegalArgumentException
- if sender, alias, or args is nullCopyright © 2020. All rights reserved.