# AFK

Detects idle players: manual AFK toggle, automatic AFK after inactivity, optional kick and detection of simple AFK machines. AFK players get a tablist prefix; the [sleep system](sleep.html) can exclude them from the sleep calculation.

## Commands

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| `/afk` | `/afk` | `afk.use` | `true` | Toggles AFK status manually |

## Additional permissions

| Permission | Default | Description |
|---|---|---|
| `afk.bypass.timeout` | `false` | Never set AFK automatically |
| `afk.bypass.kick` | `false` | Never kicked for being AFK |
| `afk.bypass.antiafk` | `false` | Excluded from AFK machine detection |

Movement, block interaction, combat, inventory use, jumping, sprinting and chat count as activity. Activity immediately lifts the AFK status.

> **Tip:** For PvP servers a low `auto-afk-timeout` fits (120 to 180 seconds), for survival servers a higher one (300 to 600 seconds).

## Configuration (modules/afk.yml)

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

afk:
  # Seconds without activity until a player goes AFK automatically.
  # 0 disables auto-AFK.
  auto-afk-timeout: 300
  # Seconds in AFK status until the automatic kick. 0 = no kick.
  kick-timeout: 0
  # Announces AFK changes (in/out) to all players.
  broadcast: true
  # Tablist decoration while a player is AFK.
  tablist-prefix: "<gray>[AFK] "
  tablist-suffix: ""
  anti-afk-machine:
    # Detects AFK machines: whoever moves only within radius blocks
    # during the window (seconds) and reaches fewer than
    # min-unique-positions distinct block positions still counts as AFK
    # despite moving.
    enabled: true
    min-unique-positions: 3
    window: 60
    radius: 5
```

## Complete example config

```yaml
enabled: true

afk:
  auto-afk-timeout: 180
  kick-timeout: 600
  broadcast: false
  tablist-prefix: "<dark_gray>[<yellow>AFK<dark_gray>] "
  tablist-suffix: ""
  anti-afk-machine:
    enabled: true
    min-unique-positions: 5
    window: 90
    radius: 8
```
