Search in sources :

Example 1 with Lockable

use of org.bukkit.block.Lockable in project Denizen-For-Bukkit by DenizenScript.

the class ItemLock method adjust.

@Override
public void adjust(Mechanism mechanism) {
    // -->
    if (mechanism.matches("lock")) {
        BlockStateMeta bsm = ((BlockStateMeta) item.getItemMeta());
        Lockable lockable = (Lockable) bsm.getBlockState();
        lockable.setLock(mechanism.hasValue() ? mechanism.getValue().asString() : null);
        bsm.setBlockState((BlockState) lockable);
        item.setItemMeta(bsm);
    }
}
Also used : BlockStateMeta(org.bukkit.inventory.meta.BlockStateMeta) Lockable(org.bukkit.block.Lockable)

Aggregations

Lockable (org.bukkit.block.Lockable)1 BlockStateMeta (org.bukkit.inventory.meta.BlockStateMeta)1