# CopperKeys 1.1.0

Paper 26.2 plugin that adds a key item and event-driven locks for containers and openable blocks.

## Requirements

- Paper 26.2
- Java 25
- Resource pack in `resource-pack/`

## Build

```bash
gradle clean build
```

The plugin jar is created in `build/libs/`.

## Resource pack

Zip the *contents* of `resource-pack/` so `pack.mcmeta` is at the root of the zip. A ready-to-use zip is distributed alongside the source archive.

The supplied texture is the user's 16x16 key sprite and is selected through the `minecraft:item_model` component (`copperkeys:key`).

## Behaviour

- Two copper nuggets placed diagonally craft a `Blank Key`.
- Keys stack only with other keys that share the same binding (or other blank keys). Max stack size 64 so many fit in a Bundle.
- Right-click a supported unlocked block with a Blank Key to bind it.
- Bound keys display `Unlocks <block name>`.
- Containers require the matching key somewhere in the player's inventory, including recursively inside Bundles and Shulker Boxes.
- Locked doors/trapdoors/fence gates may always be closed, but cannot be opened without the matching key. Redstone may close them but may not open them.
- Locked iron doors and iron trapdoors can be toggled open/closed by right-clicking with the matching key in hand.
- Rename a bound key with `/keyname <name>` or an anvil; all copies with the same binding update. Blank keys cannot be named.
- Advancements (toast only, no chat): Burglar, Oops..., Sharing is Caring, Heavy Duty, Locked Out, Organising.
- Hopper transfers, hopper pickup/search and Copper Golem target validation are denied for locked containers.
- Breaking either half of a double chest or either half of a door breaks the binding.
- Keys found online are immediately blanked when their bound block is broken. Keys elsewhere are lazily blanked the next time the plugin encounters them.
- No periodic world or inventory scan is used.

## Persistence

Block bindings are stored in `plugins/CopperKeys/locks.yml`. The binding UUID itself is stored on the key item using the Persistent Data Container.
