# Permissions

KyuubiSoft Lootbags uses two permission nodes. Command syntax is on the [Commands](./commands) page.

## Permission Nodes

| Permission | Default | Gates |
|------------|---------|-------|
| `ks.lootbag.user.use` | allowed | Opening a bag with a right-click, `/kslootbags` (aliases `lb`, `lootbag`) with every subcommand (catalog, `crate`, `stats`, `settings`), and pressing **F** on a placed bag |
| `ks.lootbag.admin` | not granted | `/kslootbagsadmin` (alias `lbadmin`) with every subcommand, the [admin panel](./admin-panel) (also when opened from the KyuubiSoft Core admin menu) |

**How the defaults work:**

- `ks.lootbag.user.use` is checked as "allowed unless set". Every player can open bags and use `/kslootbags` out of the box. To block it, set the node to `false`; the player then gets "You do not have permission for this." from the command and from a right-click (the bag is not used up); F on a placed bag does nothing.
- `ks.lootbag.admin` is the required permission of `/kslootbagsadmin` and of each of its subcommands. The admin panel checks it again on every click, so taking the node away while the panel is open stops it at the next click ("No permission (ks.lootbag.admin)").
- `/kslang` has no permission: every player may pick their language.

## What the Nodes Do Not Cover

- **The Open another button.** The opening window only appears after an opening that passed the `ks.lootbag.user.use` check; its **Open another** button does not check the node again.
- **Placing bags.** Crouch + right-click places a bag like any block.
- **Drops.** Every player can receive bags from creatures and mining. Use the drop rules or `dropEnabled` to change that.
- **The catalog through an NPC.** A KyuubiSoft Core citizen with the ID `showcase_lootbag` opens the catalog for every player who talks to it, without a permission check.
- **Tooltips** (DynamicTooltipsLib) show for every player.

## LuckPerms Examples

### Staff gets the admin tools

```
/lp group admin permission set ks.lootbag.admin true
/lp user Steve permission set ks.lootbag.admin true
```

### No lootbags for a group

```
/lp group guest permission set ks.lootbag.user.use false
```

Players of that group can neither open bags nor use `/kslootbags` or F on a placed bag. They can still receive bags from drops and still see the catalog through a `showcase_lootbag` NPC.

### Everything default (no setup)

Nothing to do: `ks.lootbag.user.use` is allowed when it is not set, and `ks.lootbag.admin` is only granted where you add it.

## Notes for Upgrades

- The admin command is `/kslootbagsadmin` (with "s"), its node is `ks.lootbag.admin` (singular "lootbag"). The old auto-generated command permission is not used anymore.
- Before 2.0.0 the admin panel opened from the Core admin menu did not check `ks.lootbag.admin`. It does now; Core's own `ks.admin` node only opens the Core menu itself.
- Before 2.0.0 right-click opening had no permission check. It now checks `ks.lootbag.user.use`; groups where you set the node to `false` can no longer open bags.