# Commands

KyuubiSoft Lootbags registers two commands, plus `/kslang` when it is the first KyuubiSoft mod to load.

| Command | Aliases | Used by | Permission |
|---------|---------|---------|------------|
| `/kslootbags` | `lb`, `lootbag` | players | `ks.lootbag.user.use` (allowed by default) |
| `/kslootbagsadmin` | `lbadmin` | players; `reload`, `list`, `preview` and `edit` also from the console | `ks.lootbag.admin` |
| `/kslang` | none | players | none |

Bag IDs are case-sensitive (`Golden_Lootbag_Epic`, not `golden_lootbag_epic`). `/lbadmin list` prints all of them. Details on the nodes are on [Permissions](./permissions).

---

## `/kslootbags`

| Usage | What it does |
|-------|--------------|
| `/kslootbags` | Opens the [catalog](./ui-pages#catalog) |
| `/kslootbags crate <id>` | Opens the catalog on the bag with this ID |
| `/kslootbags stats` | Shows your statistics in chat |
| `/kslootbags settings animation on\|off` | Switches your opening window on or off |
| `/kslootbags <anything else>` | Shows the list of these subcommands |

From the console the command answers "This command is for players only.". A player without `ks.lootbag.user.use` gets "You do not have permission for this.". While "Lootbags active" (`enabled`) is off, the catalog does not open (`/kslootbags` and `crate` answer "Lootbags are turned off on this server."); `stats` and `settings` keep working.

### `/kslootbags crate <id>`

Opens the catalog with that bag selected (its style and tier). An unknown ID answers `Lootbag not found: <id>`. This is the same view you get when you press **F** on a placed bag.

```
/kslootbags crate Crystal_Lootbag
/lb crate Golden_Lootbag_Legendary
```

### `/kslootbags stats`

Prints your totals: bags opened, opened per tier, items received and your ten most opened bags with their count. The catalog's [History](./ui-pages#history) tab shows the same record (with the top three bags) and your last openings.

"Items received" counts every item of an opening once, whatever its stack size: a bag that gave 5 bread and 1 sword counts as 2.

### `/kslootbags settings animation on|off`

| Value | Effect |
|-------|--------|
| `on` or `true` | The [opening window](./ui-pages#opening-window) is shown after every opening |
| any other value, e.g. `off` | Opened bags are only listed in the chat |

The choice is saved in your player file. When the server turns the opening window off (`revealPageEnabled: false`), the chat summary is used for everyone, whatever players chose.

---

## `/kslootbagsadmin`

Alias `/lbadmin`. Every subcommand requires `ks.lootbag.admin`. The command on its own does nothing; use one of the subcommands.

### `/lbadmin panel`

Opens the [admin panel](./admin-panel). Players only.

### `/lbadmin give <id> [amount]`

Gives **you** a bag. To give bags to another player, use the **Give** section of the admin panel.

| Argument | Required | Description |
|----------|----------|-------------|
| `id` | yes | Bag ID, e.g. `Default_Lootbag` or `Golden_Lootbag_Legendary` |
| `amount` | no | Number of bags, at least `1`, default `1` |

The command answers "Gave 5x Golden_Lootbag_Legendary". What does not fit into your inventory is dropped at your feet, like the admin panel's Give, and a second line says "2 items are on the ground in front of you.". Players only.

- Only lootbags are handed out. An ID that is no bag answers "Lootbag not found: <id>". An old or tier-suffixed ID of a shipped style, such as `Easter_Lootbag_Common` or `Crystal_Lootbag_Epic`, gives the bag of the same style and tier.
- An amount below 1 or no number answers "Invalid amount: 0" and gives nothing.

```
/lbadmin give Golden_Lootbag_Legendary
/lbadmin give Shadow_Lootbag_Epic 5
```

### `/lbadmin edit <id> <property> <value>`

Changes one bag and saves it to `custom/custom_lootbags.json` right away; the change is live without a reload. The bag must exist (create new bags in the admin panel or in the JSON file, see [Custom Lootbags](./custom-lootbags)).

| Property | Value | Effect |
|----------|-------|--------|
| `rarity` | `common`, `uncommon`, `rare`, `epic`, `legendary` | Sets the tier. The catalog shows the bag under the new tier |
| `dupes` | `true` or `on`, anything else = off | Whether the pool may draw the same item twice |
| `name` | text, spaces allowed | Sets the bag's own name, saved as typed (also with commas and brackets). The windows show it instead of the translated style name, next to the tier |
| `picks` | number, at least 0 | How many items are drawn from the pool |
| `gadd` | `<itemId> [amount]` | Adds a guaranteed item (amount default 1) |
| `padd` | `<itemId> [amount] [weight]` | Adds a pool item (amount default 1, weight default 10) |
| `gdel` | none | Removes the **last** guaranteed item |
| `pdel` | none | Removes the **last** pool item |

The item IDs of `gadd` and `padd` are not checked; a wrong ID is skipped (and logged) when the bag is opened. The admin panel checks them before it saves.

```
/lbadmin edit Default_Lootbag rarity rare
/lbadmin edit Default_Lootbag name Starter Bag
/lbadmin edit Default_Lootbag picks 2
/lbadmin edit Default_Lootbag dupes true
/lbadmin edit Default_Lootbag gadd Food_Bread 5
/lbadmin edit Default_Lootbag padd Weapon_Sword_Copper 1 25
/lbadmin edit Default_Lootbag gdel
```

Without enough arguments the command prints its usage and these examples.

### `/lbadmin reload`

Reloads `config.json`, `configs/lootbags.json`, `custom/custom_lootbags.json` and `configs/drop_tables.json`, and registers items for new custom bags. Answers "Lootbag configs reloaded! 150 definitions loaded.". Language files are **not** reloaded; they are read at server start.

The **Reload** button in the admin panel does the same and also throws away that panel's unsaved changes.

### `/lbadmin list`

Prints every bag as `<id> [<RARITY>] - <name>` in its tier color, sorted by ID. The name is the one written in the bag file (for example "Default Lootbag (Common)").

### `/lbadmin preview <id>`

Prints the bag's name, rarity and type (Fixed, Random or Hybrid) and one simulated opening with its items. Nothing is given, no bag is used up. Each call rolls again, so the drawn items change.

```
/lbadmin preview Golden_Lootbag
```

### `/lbadmin lang [code]`

| Usage | Effect |
|-------|--------|
| `/lbadmin lang` | Shows your current language and the available codes |
| `/lbadmin lang de-DE` | Sets your language |
| `/lbadmin lang auto` (or `reset`) | Back to your client language |

This stores the same choice as `/kslang`, so it applies to every KyuubiSoft mod. When the server sets the language for everyone (Core's "players may choose" switch is off), it answers with that language instead of storing a choice. Apart from that note, the answers of this subcommand are English only. Players only.

---

## `/kslang`

Shared by all KyuubiSoft mods; the first mod that loads registers it, every mod reads the same choice from `mods/kslang/prefs.json`.

| Usage | Effect |
|-------|--------|
| `/kslang <code>` | Sets your language, e.g. `/kslang de-DE` (`/kslang dede` works too) |
| `/kslang auto` (or `reset`) | Uses your client language again |
| `/kslang` | Answers in chat with your current language (and whether it is auto-detected), the available codes and how to change it |

See [Configuration](./configuration#languages) for how the language is picked.

---

## Command summary

| Command | Permission | Description |
|---------|------------|-------------|
| `/kslootbags` | `ks.lootbag.user.use` | Opens the catalog |
| `/kslootbags crate <id>` | `ks.lootbag.user.use` | Catalog on one bag |
| `/kslootbags stats` | `ks.lootbag.user.use` | Your statistics in chat |
| `/kslootbags settings animation on\|off` | `ks.lootbag.user.use` | Opening window or chat only |
| `/lbadmin panel` | `ks.lootbag.admin` | Opens the admin panel |
| `/lbadmin give <id> [amount]` | `ks.lootbag.admin` | Gives you a bag |
| `/lbadmin edit <id> <property> <value>` | `ks.lootbag.admin` | Changes and saves a bag |
| `/lbadmin reload` | `ks.lootbag.admin` | Reloads config, bags and drop rules |
| `/lbadmin list` | `ks.lootbag.admin` | Lists every bag |
| `/lbadmin preview <id>` | `ks.lootbag.admin` | Simulates one opening |
| `/lbadmin lang [code]` | `ks.lootbag.admin` | Sets your language |
| `/kslang [code]` | none | Sets your language for all KyuubiSoft mods |