程序包 org.bukkit.block

接口 Lockable

所有已知子接口:
Barrel, Beacon, BlastFurnace, BrewingStand, Chest, Container, Crafter, Dispenser, Dropper, Furnace, Hopper, ShulkerBox, Smoker

public interface Lockable
代表有锁的方块 (通常是容器类方块). 当锁激活时, 开锁时需要物品名与钥匙相符的物品.
  • 方法概要

    修饰符和类型
    方法
    说明
    已过时。
    锁不一定只是字符串
    boolean
    检测容器是否有一个有效的(非空的)钥匙.
    void
    已过时。
    锁不一定只是字符串
    void
    Sets the key required to access this container.
  • 方法详细资料

    • isLocked

      boolean isLocked()
      检测容器是否有一个有效的(非空的)钥匙.

      原文:Checks if the container has a valid (non empty) key.

      返回:
      是否有有效的钥匙
    • getLock

      已过时。
      锁不一定只是字符串
      获取访问此容器所需的钥匙.

      原文:Gets the key needed to access the container.

      返回:
      所需的钥匙 (或者称为密钥、钥匙的物品名)
    • setLock

      @Deprecated(since="1.21.2") void setLock(@Nullable @Nullable String key)
      已过时。
      锁不一定只是字符串
      设置访问此容器所需的钥匙. 设为 null 或空字符串以移除钥匙.

      原文:Sets the key required to access this container. Set to null (or empty string) to remove key.

      参数:
      key - 所需的钥匙
    • setLockItem

      @Experimental void setLockItem(@Nullable @Nullable ItemStack key)
      Sets the key required to access this container. All explicit modifications to the set key will be required to match on the opening key. Set to null to remove key.
      参数:
      key - the key required to access the container.