# Developer Tools

# Developer Tools

> **Mod:** `kyuubisoft-core.jar` | **Output:** `mods/kyuubisoft_core/dev-export/`

Core ships two tools for server owners and content creators: the `/ksdev` data export (alias `/dev`) and the browser-based **Web Config Editor** (`/kseditor`).

## Data Export — `/ksdev`

Export lists of all items, blocks, entities and other game data — useful when you create quests, achievements or shops.

:::warning Permission
`/ksdev` needs `ks.admin.dev`. Players also need the older node `dev.admin`; the server console needs neither.
:::

| Subcommand | Description | Output |
|------------|-------------|--------|
| `/ksdev items` | Export all items | JSON with categories, consumable flag, stack size, durability, resource types |
| `/ksdev blocks` | Export all blocks | JSON with groups, materials, opacity, properties |
| `/ksdev entities` | Export all entity types and NPC roles | JSON with entity type list and NPC role names |
| `/ksdev citizens` | Export all citizen data | JSON with citizen IDs, positions, models, shops |
| `/ksdev worlds` | Export all worlds | JSON with world names, game mode, PvP, spawn settings |
| `/ksdev emotes` | Export all emotes | JSON with emote keys, names, animations, and animation slots |
| `/ksdev all` | Export everything | All of the above at once |

### Output Location

Export files are saved to `mods/kyuubisoft_core/dev-export/` on the server, one file per type (`items.json`, `blocks.json`, …). Each export overwrites the previous file of the same type.

### Usage with the Mod Editor

The exported JSON files can be imported into the [Mod Editor](https://modeditor.kyuubisoft.com/) to power autocomplete for item names, entity types and block IDs when creating quests and achievements.

1. Run `/ksdev all` on your server.
2. Download the export files from `mods/kyuubisoft_core/dev-export/`.
3. Drag and drop them into the Mod Editor's import area.

## Web Config Editor — `/kseditor`

The web editor lets you edit the config files of Core and other KS mods (NPCs, shops, lootbags, translations and the files mods offer) in the browser, and apply the changes to the running server.

### Turning it on

The web editor is **off** by default. Set `modules.webEditor` to `true` in `mods/kyuubisoft_core/config.json`, or use the web editor switch in the **Status** tab of `/ksadmin`, then restart the server. The switch only applies after a restart.

### Commands

| Command | Description |
|---|---|
| `/kseditor` | Start an editor session. The link is shown only to you (never written to the server log). |
| `/kstrusteditor <code>` | Confirm your session with the code the editor shows. Works in game and from the console. |
| `/ksapplyconfig <code>` | Apply changes manually when the live connection is not available (in game only). |

All three need `ks.admin.editor`; players also need the older node `kyuubisoft.editor`.

### How a session works

1. Run `/kseditor` and open the link.
2. The editor shows a one-time code. Confirm it in game (or in the console, for a console session) with `/kstrusteditor <code>`. Until then, nothing you change is applied.
3. Changes now apply live. `/ksapplyconfig <code>` only works for **your own** confirmed session — a code someone hands you never changes files on its own.
4. A confirmed session needs a new confirmation after 30 minutes without applied changes (`webEditor.trustIdleTimeoutMinutes` in `config.json`). The editor then shows a new code right away.

Codes are one-time codes: reloading the editor shows the same code, and a used or expired code is never accepted again.

### What the editor may change

- Imports only write a mod's own config files (the exported files, new files next to them and `custom/`), never player data or paths outside the mod folder.
- Translations only accept plain language codes such as `en-US`.
- NPC, shop and lootbag files are written atomically. An NPC or lootbag file that could not be read is never overwritten.
- **Console commands are protected:** without `ks.core.admin.dialog.console` (or a session started from the server console), an import cannot add, change or remove NPC or shop commands that run as the console, nor change who may trigger them. Everything else of the import is applied, and the result, the server log and a chat message to the session owner name what was kept. NPCs with console commands are also not deleted or disabled by such an import.

### Config fields

| Field | Default | Description |
|---|---|---|
| `modules.webEditor` | `false` | Turns the web editor on (applies after a restart). |
| `webEditor.editorUrl` | `https://editor.kyuubisoft.com` | Address of the editor web page. |
| `webEditor.sessionTimeoutMinutes` | `120` | How long a session lives. |
| `webEditor.trustIdleTimeoutMinutes` | `30` | Minutes without applied changes before the session needs `/kstrusteditor` again. |

## Command Aliases

| Full Command | Alias |
|---|---|
| `/ksdev` | `/dev` |