# World Management

# World Management

Manage your Hytale server worlds including configuration, file editing, and world settings.

## Overview

The Worlds page provides:
- **World tree navigation** - Browse all worlds and their files
- **Config editor** - Visual form for world settings
- **File editor** - Edit any world file as JSON
- **Danger zone** - Destructive operations with confirmation

## Navigation

### World Tree

The left sidebar displays:
- List of all worlds
- File count per world
- Expandable file trees
- First world auto-expands on load

### File Categories

Each world contains:
- **Root files** - `config.json` and other base files
- **Resources folder** - Nested resource files
- **Player data** - Per-player world data

## World Configuration

### Config Editor

Select a world's `config.json` to open the visual editor with grouped sections:

#### World Info (Read-only)

| Setting | Description |
|---------|-------------|
| Seed | World generation seed |
| Game Time | Current in-game time |

#### Gameplay Settings

| Setting | Description | Default |
|---------|-------------|---------|
| PvP Enabled | Allow player vs player | true |
| Fall Damage | Players take fall damage | true |
| NPC Spawning | NPCs can spawn | true |
| All NPCs Frozen | Freeze all NPCs | false |
| Compass Updating | Compass points to objective | true |
| Spawn Markers | Show spawn markers | true |
| Objective Markers | Show objective markers | true |

#### World Ticking

| Setting | Description | Default |
|---------|-------------|---------|
| World Ticking | World updates (time, weather) | true |
| Block Ticking | Block updates (growth, decay) | true |
| Game Time Paused | Pause day/night cycle | false |

#### Storage & Saving

| Setting | Description | Default |
|---------|-------------|---------|
| Save Players | Save player data | true |
| Save Chunks | Save chunk data | true |
| Save New Chunks | Save newly generated chunks | true |
| Unload Chunks | Unload unused chunks | true |

#### Danger Zone

:::danger
These operations can cause data loss!
:::

| Setting | Description |
|---------|-------------|
| Delete on Universe Start | Delete world when universe starts |
| Delete on Remove | Delete files when world removed |

A confirmation dialog appears before enabling these options.

### Text Mode

Toggle to **Text Mode** for raw JSON editing:
- Direct JSON editing
- Full file content access
- Manual save required

## File Editor

For non-config.json files:

1. Click any file in the tree
2. Editor opens on the right
3. Edit JSON content
4. Click **Save**

### Supported File Types

All world files are JSON format:
- `config.json` - World settings
- `resources/*.json` - Resource definitions
- Other configuration files

### Form Editor Features

The intelligent form editor provides:
- **String fields** - Text inputs
- **Number fields** - Number inputs
- **Boolean fields** - Toggle switches
- **Arrays** - JSON textarea with validation
- **Nested objects** - Indented sub-forms

Labels are auto-generated from property names (camelCase → Title Case).

## API Reference

### Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/management/worlds` | List all worlds |
| GET | `/api/management/worlds/:name/config` | Get world config |
| PUT | `/api/management/worlds/:name/config` | Update world config |
| GET | `/api/management/worlds/:name/files/:path` | Get any file |
| PUT | `/api/management/worlds/:name/files/:path` | Update any file |

### World Info Response

```json
{
  "worlds": [
    {
      "name": "world",
      "hasConfig": true,
      "files": [
        {
          "name": "config.json",
          "path": "config.json",
          "size": 1024,
          "lastModified": "2024-01-15T10:30:00Z"
        }
      ]
    }
  ]
}
```

### World Config Response

```json
{
  "name": "world",
  "seed": 12345,
  "isTicking": true,
  "isBlockTicking": true,
  "isPvpEnabled": true,
  "isFallDamageEnabled": true,
  "isGameTimePaused": false,
  "gameTime": "12:00",
  "isSpawningNPC": true,
  "isAllNPCFrozen": false,
  "isSpawnMarkersEnabled": true,
  "isObjectiveMarkersEnabled": true,
  "isSavingPlayers": true,
  "isSavingChunks": true,
  "saveNewChunks": true,
  "isUnloadingChunks": true,
  "isCompassUpdating": true,
  "deleteOnUniverseStart": false,
  "deleteOnRemove": false
}
```

## Permissions

| Permission | Description |
|------------|-------------|
| `worlds.view` | Browse worlds and files |
| `worlds.manage` | Edit and save world files |

## Quick Settings

For common settings, use Quick Settings in the Configuration page:

| Setting | Description |
|---------|-------------|
| Server Name | Server display name |
| MOTD | Message of the day |
| Max Players | Maximum concurrent players |
| Password | Server password |
| Max View Radius | Render distance (1-64 chunks) |
| Default Game Mode | Adventure or Creative |

Quick Settings changes require server restart.

## Server Configuration

### Config Files

View and edit server config files from Configuration page:
- `config.json` - Main server config
- `panel-config.json` - Panel settings
- Other configuration files

### Update Configuration

Configure automatic updates:

| Setting | Options |
|---------|---------|
| Enabled | On/Off |
| Check Interval | 30min, 1h, 2h, 6h, 12h, 24h |
| Patchline | Release or Pre-Release |
| Auto-Apply Mode | Disabled, When Empty, Scheduled |
| Apply Delay | 1-60 minutes (scheduled only) |
| Player Notifications | On/Off |
| Backup Before | On/Off |
| Backup Config | On/Off |

## Best Practices

1. **Backup before editing** - Always backup worlds before major changes
2. **Use form mode** - Reduces JSON syntax errors
3. **Test on copy** - Test changes on a world copy first
4. **Don't disable saving** - Only disable for testing
5. **Be careful with danger zone** - These settings delete data

## Troubleshooting

### Changes Not Applying

1. Server restart may be required
2. Check file permissions
3. Verify JSON syntax is valid

### World Not Listed

1. Check world folder exists
2. Verify config.json is present
3. Restart panel to refresh

### File Save Fails

1. Check disk space
2. Verify container permissions
3. Check for JSON syntax errors