# Inventories and rollbacks

Live invsee, offline captures, snapshots, tracked restores and revoking restored items.

Two modules handle inventories. **Invsee** is for looking at, or editing, what a player has right now. **Inventory** keeps snapshots and restores them.

## Invsee

```text
/invsee Steve
/invsee Steve ender
/invsee 069a79f4-44e9-4726-a5be-fca90e38aaf5 inventory
```

- For an online player it opens a live view of their inventory or ender chest.
- For an offline player it opens the most recent capture, read-only.
- Views are read-only by default (`read-only-default: true`). Edits need the edit permissions and are checked so they can't duplicate items.

## Snapshots

Snapshots are saved automatically on join, quit and death, and manually with:

```text
/inventory save Steve
/inventory view Steve
```

Each player keeps up to `max-snapshots-per-player` (25 by default), newest first. Players with `glacierstaff.staff.inventory.autosave-bypass` get no death snapshot.

## Restoring

### Rollback

```text
/inventory rollback Steve 2
```

Queues every saved stack from snapshot `2` as a tracked restore. It works for offline players too: items wait until they join.

### Selective restore

```text
/inventory restore Steve 2
```

Opens a menu where you pick individual slots to restore.

### How restores land

Tracked restores add missing items and never overwrite stacks the player already has. If there's no room, the items wait:

```text
/inventory restores Steve
/inventory collect Steve
```

`restores` lists restore IDs and their status. `collect` delivers what's pending once the player has made space.

To replace an online player's whole inventory instead, set:

```yaml
restores:
  replace-online-inventory: true
```

Their current inventory is backed up first.

## Revoking a restore

Every restored item is tagged with its restore ID. If a restore was a mistake, or a player was duping off it:

```text
/inventory revoke Steve <id>
```

Tagged copies are removed. Revocation also follows the tag through crafting, anvil and smelting outputs when it encounters them.

## Deleting snapshots

```text
/inventory delete Steve 2
```

Saving, rolling back and deleting are all written to the staff log.
