Create a Paper Minecraft plugin called "DeathBanPlugin" with the following specifications. Read every point carefully and ensure nothing is missed. This plugin must handle all previously discussed features, plus the following:
1. **Core Death Ban Mechanics**
- Players are **temporarily banned** only when killed by another player (PvP).
- Ban triggers **even if the player clicks “Respawn” after death**.
- Natural deaths (fall, lava, mobs, void) **do NOT trigger a ban**.
- Ban duration is **configurable** in seconds (default 24 hours).
- Ban applies to **UUID, IP, or both**, configurable separately (`ban-uuid: true/false`, `ban-ip: true/false`).
- On death by PvP:
- Switch player to **spectator mode** for a configurable duration (default 3 seconds).
- Disconnect with a **customizable kick message**.
- Show a **custom ban message** after disconnect, like operator bans.
- Store ban info in a persistent YAML file (`bans.yml`) including: UUID, player name, IP, killer name, banned-at timestamp, unban-at timestamp.
- After ban expires:
- Automatically **remove the entry** from the ban file.
- If the player is online and still in spectator mode, switch to **survival** and send **unban message**.
- If the player joins after the ban expires, ensure they spawn in **survival mode**, not spectator.
2. **Configuration Options**
- `ban-duration` (seconds)
- `spectator-duration` (seconds before disconnect)
- `check-interval` (seconds between automatic unban checks)
- `ban-ip: true/false`
- `ban-uuid: true/false`
- `play-sound: true/false` (plays sound on PvP death)
- Messages (all configurable) with placeholders `{player}`, `{killer}`, `{duration}`, `{remaining}`, `{banned-at}`, `{unban-at}`:
- `ban-message`, `kick-message`, `ban-reason`, `unban-message`, `already-banned`, `not-banned`, `player-not-found`, `unbanned-target`, `unbanned-sender`, `ban-info`, `reload-success`.
- Sound settings:
- `death-sound` (default `ENTITY_WITHER_DEATH`), `volume`, `pitch`.
3. **Gameplay Features**
- Play the configured sound at the killer’s location.
- Ban triggers **even if the player clicks Respawn** after death.
- Ensure **gamemode restoration** for online and newly joining players.
- Prevent bypass:
- Name changes do not bypass bans (ban by UUID/IP).
- If `ban-ip: true`, other accounts on same IP cannot bypass.
4. **Administrative Commands**
- `/deathban unban `: unban and restore survival.
- `/deathban info `: show banned-at, unban-at, killer, remaining.
- `/deathban reload`: reload config and messages.
- Commands respect **LuckPerms permissions** if installed.
5. **File Storage**
- Store banned players in `bans.yml`:
```
bans:
:
name:
uuid:
ip:
killer:
banned-at:
unban-at:
```
- Entries automatically removed when ban expires.
- Check online players every `check-interval` seconds for gamemode restoration and notifications.
6. **Edge Cases**
- Non-player deaths → no ban.
- Player disconnects during spectator → ban still applies.
- Player online when ban expires → survival restored.
- Player joins after ban expires → survival restored.
- Placeholders must work in all messages.
7. **Technical Requirements**
- Compatible with **Paper 1.21+**.
- Supports offline/cracked servers with consistent UUIDs.
- Proper error handling if UUID/IP already banned.
- Anti-bypass measures: combine UUID/IP bans, prevent name changes, restore gamemode after unban, handle both online and offline players.
8. **Testing & Safety**
- Ensure PvP-only deaths trigger bans, natural deaths do not.
- Ensure clicking Respawn still triggers the deathban.
- Ensure IP + UUID enforcement prevents basic bypass attempts.
- Ensure gamemode restoration works for online and newly joining players.
- All messages, sounds, placeholders, and config options must function correctly.
**IMPORTANT:** This must fix all previous issues, including players bypassing bans or staying in spectator after unban. Include **every feature discussed**, double-check all placeholders, automatic unban handling, file storage, PvP-only logic, IP + UUID enforcement, spectator → survival restoration, Respawn click enforcement, and admin commands.