public final class PluginCommand extends Command implements PluginIdentifiableCommand
命令
.description, usageMessage
限定符 | 构造器和说明 |
---|---|
protected |
PluginCommand(java.lang.String name,
Plugin owner) |
限定符和类型 | 方法和说明 |
---|---|
boolean |
execute(CommandSender sender,
java.lang.String commandLabel,
java.lang.String[] args)
执行一个命令.
|
CommandExecutor |
getExecutor()
获取与这个命令关联的
CommandExecutor . |
Plugin |
getPlugin()
获取拥有这个PluginCommand的插件.
|
TabCompleter |
getTabCompleter()
获取与这个命令关联的
TabCompleter . |
void |
setExecutor(CommandExecutor executor)
设置当命令解析时运行的
CommandExecutor . |
void |
setTabCompleter(TabCompleter completer)
设置当(玩家)进行命令补全时执行的
TabCompleter . |
java.util.List<java.lang.String> |
tabComplete(CommandSender sender,
java.lang.String alias,
java.lang.String[] args)
执行此命令的tab补全时返回选项列表.
|
java.lang.String |
toString() |
broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, unregister
protected PluginCommand(java.lang.String name, Plugin owner)
public boolean execute(CommandSender sender, java.lang.String commandLabel, java.lang.String[] args)
原文:Executes the command, returning its success
public void setExecutor(CommandExecutor executor)
CommandExecutor
.
原文:Sets the CommandExecutor
to run when parsing this command
executor
- 要运行的新Executorpublic CommandExecutor getExecutor()
CommandExecutor
.
原文:Gets the CommandExecutor
associated with this command
CommandExecutor
public void setTabCompleter(TabCompleter completer)
TabCompleter
.
如果没有指定 TabCompleter,这个命令执行器实现了TabCompleter,执行器将用来做命令补全.
原文:Sets the 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
- 新的TabCompletepublic TabCompleter getTabCompleter()
TabCompleter
.
原文:Gets the TabCompleter
associated with this command.
TabCompleter
public Plugin getPlugin()
原文:Gets the owner of this PluginCommand
getPlugin
在接口中 PluginIdentifiableCommand
public java.util.List<java.lang.String> tabComplete(CommandSender sender, java.lang.String alias, java.lang.String[] args) throws CommandException, java.lang.IllegalArgumentException
原文:Executed on tab completion for this command, returning a list of options the player can tab through.
委托的tab补全器(如果存在).
如果它不存在或者返回null,将委托给当前命令的执行器如果它实现了TabCompleter
.如果找不到非null的list,将默认在Command.tabComplete(CommandSender, String, String[])
里使用玩家名字.
这个方法不会判断权限.
原文: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
在类中 Command
sender
- 执行此命令的对象alias
- 被使用的别名args
- 传递给此命令的所有参数,用' '分割CommandException
- 如果补全器或执行器在补全过程中抛出了异常java.lang.IllegalArgumentException
- 如果参数sender, alias, 或 args 是null