程序包 org.bukkit.command

# 类 PluginCommand

java.lang.Object
org.bukkit.command.Command
org.bukkit.command.PluginCommand

所有已实现的接口:
  `PluginIdentifiableCommand`

public final class PluginCommand extends Command implements PluginIdentifiableCommand
代表属于某个插件的`命令`.

- ## 字段概要

  ### 从类继承的字段 org.bukkit.command.Command

  `description, timings, usageMessage`

- ## 构造器概要

  构造器
  限定符
  构造器
  说明
  `protected`
  `PluginCommand(@NotNull String name, @NotNull Plugin owner)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `boolean`
  `execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args)`
  执行一个命令.
  `@NotNull CommandExecutor`
  `getExecutor()`
  获取与这个命令关联的`CommandExecutor`.
  `@NotNull Plugin`
  `getPlugin()`
  获取拥有这个PluginCommand的插件.
  `@Nullable TabCompleter`
  `getTabCompleter()`
  获取与这个命令关联的`TabCompleter`.
  `void`
  `setExecutor(@Nullable CommandExecutor executor)`
  设置当命令解析时运行的`CommandExecutor`.
  `void`
  `setTabCompleter(@Nullable TabCompleter completer)`
  设置当(玩家)进行命令补全时执行的`TabCompleter`.
  `List<String>`
  `tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args)`
  对此命令进行tab补全并返回补全项列表.
  `String`
  `toString()`

  ### 从类继承的方法 org.bukkit.command.Command

  `broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, unregister`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 构造器详细资料

  - ### PluginCommand

    protected PluginCommand(@NotNull @NotNull String name, @NotNull @NotNull Plugin owner)

- ## 方法详细资料

  - ### execute

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

    原文:Executes the command, returning its success

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

  - ### setExecutor

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

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

    参数:
      `executor` - 要运行的新Executor

  - ### getExecutor

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

    原文:Gets the `CommandExecutor` associated with this command

    返回:
      这个命令关联的`CommandExecutor`

  - ### setTabCompleter

    public void setTabCompleter(@Nullable @Nullable 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

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

    原文:Gets the `TabCompleter` associated with this command.

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

  - ### getPlugin

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

    原文:Gets the owner of this PluginCommand

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

  - ### tabComplete

    @NotNull public List<String> tabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull 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`