# Spawn

CoreEngine manages three kinds of spawn points: the main spawn, the first spawn for new players and group spawns per LuckPerms group (plus the [world spawn](worldspawn.html)). `/spawn` runs through the [teleport engine](teleport.html) with warmup, cooldown, cost and safety check.

## Commands

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| `/spawn` | `/spawn` | `spawn.use` | `true` | Teleports to the matching spawn |
| `/setspawn` | `/setspawn` | `spawn.admin` | `false` | Sets the main spawn |
| `/setfirstspawn` | `/setfirstspawn` | `spawn.admin` | `false` | Sets the first spawn for new players |
| `/setgroupspawn` | `/setgroupspawn <group>` | `spawn.admin` | `false` | Sets a group spawn |
| `/delgroupspawn` | `/delgroupspawn <group>` | `spawn.admin` | `false` | Deletes a group spawn |

## Additional permissions

| Permission | Default | Description |
|---|---|---|
| `spawn.bypass.groupspawn` | `false` | Forces the main spawn instead of a group spawn |

**Spawn order for `/spawn`:** group spawn → main spawn → world spawn → vanilla spawn point.

**Respawn order after death:** bed/respawn anchor (if `use-bed`) → home named `home` (if `use-home`) → spawn order as above.

> **Warning:** The first-spawn teleport on the very first join runs without a safety check. Keep that spot permanently safe.

> **Tip:** Group spawns can be set for LuckPerms groups that do not exist yet; they apply once the group is created. Without LuckPerms, group spawns cannot be resolved.

## Configuration (modules/spawn.yml)

```yaml
# Enables or disables the spawn module.
enabled: true

spawn:
  # Teleports new players to the first spawn on their first join.
  first-spawn-enabled: true
  respawn:
    # Bed/respawn anchor takes priority over the spawn logic on respawn.
    use-bed: true
    # A home named "home" takes priority over the spawn logic on respawn.
    use-home: true

cooldown:
  commands:
    # Seconds between two /spawn uses.
    spawn: 10

cost:
  commands:
    # Price for /spawn. 0 = free.
    spawn: 0

warmup:
  commands:
    spawn:
      # Countdown in seconds before the teleport.
      duration: 5
```

## Complete example config

```yaml
enabled: true

spawn:
  first-spawn-enabled: true
  respawn:
    use-bed: true
    use-home: false

cooldown:
  commands:
    spawn: 30

cost:
  commands:
    spawn: 5.0

warmup:
  commands:
    spawn:
      duration: 3
```
