类 PluginCommand

java.lang.Object
org.bukkit.command.Command
org.bukkit.command.PluginCommand
所有已实现的接口:
PluginIdentifiableCommand

public final class PluginCommand extends Command implements PluginIdentifiableCommand
代表属于某个插件的命令.
  • 构造器详细资料

    • PluginCommand

      protected PluginCommand(String name, Plugin owner)
  • 方法详细资料

    • execute

      public boolean execute(CommandSender sender, String commandLabel, String[] args)
      执行一个命令.

      原文:Executes the command, returning its success

      指定者:
      execute 在类中 Command
      参数:
      sender - 谁正在执行这个命令
      commandLabel - 命令的别名
      args - 所有传递给命令的参数,用' '(空格)分割
      返回:
      如果命令执行成功则为true,false反之
    • setExecutor

      public void setExecutor(CommandExecutor executor)
      设置当命令解析时运行的CommandExecutor.

      原文:Sets the CommandExecutor to run when parsing this command

      参数:
      executor - 要运行的新Executor
    • getExecutor

      public CommandExecutor getExecutor()
      获取与这个命令关联的CommandExecutor.

      原文:Gets the CommandExecutor associated with this command

      返回:
      这个命令关联的CommandExecutor
    • setTabCompleter

      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 - 新的TabComplete
    • getTabCompleter

      public TabCompleter getTabCompleter()
      获取与这个命令关联的TabCompleter.

      原文:Gets the TabCompleter associated with this command.

      返回:
      与这个命令关联的TabCompleter
    • getPlugin

      public Plugin getPlugin()
      获取拥有这个PluginCommand的插件.

      原文:Gets the owner of this PluginCommand

      指定者:
      getPlugin 在接口中 PluginIdentifiableCommand
      返回:
      拥有这个命令的插件
    • tabComplete

      public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException
      执行此命令的tab补全时返回选项列表.

      原文: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 - 传递给此命令的所有参数,用' '分割
      返回:
      指定参数的tab补全项列表.这将永远不会为null. 列表可能是不可变的.
      抛出:
      CommandException - 如果补全器或执行器在补全过程中抛出了异常
      IllegalArgumentException - 如果参数sender, alias, 或 args 是null
    • toString

      public String toString()
      覆盖:
      toString 在类中 Command