> For the complete documentation index, see [llms.txt](https://edseries-plugins.gitbook.io/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edseries-plugins.gitbook.io/p/edcrates/features/keys.md).

# Bulk Opening & Keys

Virtual key balances, physical key items and how bulk opening works.

## Virtual keys

Crate keys are always virtual: every player has a key balance per crate, there is no key item. `/edcrates give <player> <crate> <amount>` works for offline players too. Balances show in the menus (`{keys}`), holograms, and PlaceholderAPI.

## Lootboxes

A crate with `type: lootbox` is a physical item and nothing else (see [Crates](/p/edcrates/features/crates.md#lootboxes)): `/edcrates givelootbox` hands it out, right-clicking one opens it on the spot with the crate's animation, one per click, on the clicked block when `item.open-at-block` is true. There is no key balance for it and GUIs only preview it.

## Opening

* **Left-click** a crate icon (or a placed crate, or the placeable item): open one key with animation.
* **Q** (drop): open every key. Above `confirm.threshold` keys (menus.yml) a confirmation menu asks first; players can turn that off in the menu.
* `/crates open <crate> [amount|all]`.

## What happens in a bulk open

1. The keys are taken up front and the player is locked until the open completes.
2. The roll runs on an async thread. Below `limits.exact-roll-threshold` draws every key is rolled (cumulative weights + binary search); above it the count of each reward is sampled straight from the distribution, one sample per reward, so billions of keys cost the same as thousands and the odds are identical. Results collapse into one entry per distinct reward.
3. Actions marked async-safe (key credits) run right there. Everything else runs once per reward on the main thread with the total attached.
4. If the player logged out meanwhile the keys are refunded.
5. A chat summary lists the rewards (sorted, capped by `summary-lines`); `announce: true` rewards are broadcast.

Caps: `max-keys-per-open` trims the request (the player is told), `max-items-per-reward` bounds item rewards, `max-command-repeats` bounds `command-each`.
