Interface Lockable

All Known Subinterfaces:
Barrel, Beacon, BlastFurnace, BrewingStand, Chest, Container, Crafter, Dispenser, Dropper, Furnace, Hopper, ShulkerBox, Smoker

public interface Lockable
Represents a block (usually a container) that may be locked. When a lock is active an item with a name corresponding to the key will be required to open this block.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    locks are not necessarily pure strings
    boolean
    Checks if the container has a valid (non empty) key.
    void
    Deprecated.
    locks are not necessarily pure strings
    void
    Sets the key required to access this container.
  • Method Details

    • isLocked

      boolean isLocked()
      Checks if the container has a valid (non empty) key.
      Returns:
      true if the key is valid.
    • getLock

      @NotNull @Deprecated String getLock()
      Deprecated.
      locks are not necessarily pure strings
      Gets the key needed to access the container.
      Returns:
      the key needed.
    • setLock

      @Deprecated void setLock(@Nullable String key)
      Deprecated.
      locks are not necessarily pure strings
      Sets the key required to access this container. Set to null (or empty string) to remove key.
      Parameters:
      key - the key required to access the container.
    • setLockItem

      @Experimental void setLockItem(@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.
      Parameters:
      key - the key required to access the container.