程序包 org.bukkit.block

接口 CommandBlock

所有超级接口:
BlockState, Metadatable, PersistentDataHolder, TileState

public interface CommandBlock extends TileState
代表命令方块.
  • 方法详细资料

    • getCommand

      @NotNull @NotNull String getCommand()
      获取这个命令方块激活时运行的命令。本方法不会返回null,若此命令方块还没有设置命令,会返回空字符.

      原文:Gets the command that this CommandBlock will run when powered. This will never return null. If the CommandBlock does not have a command, an empty String will be returned instead.

      返回:
      当激活时这个命令方块将要运行的命令
    • setCommand

      void setCommand(@Nullable @Nullable String command)
      设置这个命令方块激活时运行的命令。设置这个命令为null等价于设置命令为空字符串.

      原文:Sets the command that this CommandBlock will run when powered. Setting the command to null is the same as setting it to an empty String.

      参数:
      command - 当激活时这个命令方块将要运行的命令
    • getName

      获取这个命令方块的名字.这个名字被用于命令方块执行命令。这个名字永远不会为空,默认为“@”.

      原文:Gets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. This name will never be null, and by default is "@".

      返回:
      这个命令方块的名字
    • setName

      void setName(@Nullable @Nullable String name)
      设置这个命令方块的名字。这个名字用于命令方块执行命令。设置名字为null等价于设置为“@”.

      原文:Sets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. Setting the name to null is the same as setting it to "@".

      参数:
      name - 这个命令方块的新名字