# AFK

Erkennt untätige Spieler: manueller AFK-Schalter, automatisches AFK nach Inaktivität, optionaler Kick und Erkennung einfacher AFK-Maschinen. AFK-Spieler bekommen ein Tablist-Prefix; das [Sleep-System](sleep.html) kann sie von der Schlaf-Berechnung ausschließen.

## Commands

| Command | Syntax | Permission | Default | Beschreibung |
|---|---|---|---|---|
| `/afk` | `/afk` | `afk.use` | `true` | Schaltet den AFK-Status manuell an/aus |

## Weitere Permissions

| Permission | Default | Beschreibung |
|---|---|---|
| `afk.bypass.timeout` | `false` | Wird nie automatisch AFK |
| `afk.bypass.kick` | `false` | Wird nie wegen AFK gekickt |
| `afk.bypass.antiafk` | `false` | Von der AFK-Maschinen-Erkennung ausgenommen |

Als Aktivität zählen Bewegung, Block-Interaktion, Kampf, Inventar-Nutzung, Springen, Sprinten und Chat. Aktivität hebt den AFK-Status sofort wieder auf.

> **Tipp:** Für PvP-Server passt ein niedriger `auto-afk-timeout` (120 bis 180 Sekunden), für Survival-Server ein höherer (300 bis 600 Sekunden).

## Konfiguration (modules/afk.yml)

```yaml
# Schaltet das AFK-Modul ein oder aus.
enabled: true

afk:
  # Sekunden ohne Aktivität, bis ein Spieler automatisch AFK wird.
  # 0 deaktiviert Auto-AFK.
  auto-afk-timeout: 300
  # Sekunden im AFK-Status bis zum automatischen Kick. 0 = kein Kick.
  kick-timeout: 0
  # Meldet AFK-Wechsel (rein/raus) an alle Spieler.
  broadcast: true
  # Tablist-Dekoration, solange ein Spieler AFK ist.
  tablist-prefix: "<gray>[AFK] "
  tablist-suffix: ""
  anti-afk-machine:
    # Erkennt AFK-Maschinen: Wer sich im Zeitfenster (window, Sekunden)
    # nur innerhalb von radius Blöcken bewegt und dabei weniger als
    # min-unique-positions verschiedene Block-Positionen erreicht,
    # gilt trotz Bewegung weiter als AFK.
    enabled: true
    min-unique-positions: 3
    window: 60
    radius: 5
```

## Komplette Beispiel-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
```
