
ValheimDeathBan
Ban accounts after character death. Persistent bans, admin immunity and a death journal. Server handles bans; optional client installation adds death reasons.Valheim Death Ban
Current source version: 1.2.6.
Standalone permadeath mod for Valheim. When the server detects a connected player's death, it bans their account and disconnects them after a configurable delay. Creating a new character on the same account does not bypass the ban.
Features
- Persistent account bans using Valheim's native ban list.
- Server-side death detection through the
s_deadflag in character ZDO data, without requiring loaded player models. - Configurable player scan interval and ban/disconnect delay.
- Admin immunity through the server's
adminlist.txt. - UTF-8 death journal with timestamps, character names, account IDs, raw reasons, sources and exemption status.
- Optional Discord webhook notifications, including the ban outcome.
- Global chat announcements and queued red banners using the Valheim-Norsebold font.
- Creature names loaded from game localization: Russian for Russian clients, English for every other client language.
- PvP death announcements with killer and victim names.
- Optional Steam whitelist backed by ValheimEnforcer’s character database.
- Separate administrator exemptions for death bans and the Enforcer whitelist.
- Automatic reload of this mod’s configuration after saved changes.
- Configurable server scan diagnostics.
- Local-world host deaths are logged; the host is always exempt from bans.
- No Jotunn or PvP Tweaks dependency. ValheimEnforcer is optional and required only for the whitelist.
Installation
Install BepInExPack Valheim and this mod on the server. For manual installation, copy ValheimDeathBan.dll to BepInEx/plugins/ValheimDeathBan/.
| Installation | Available features |
|---|---|
| Server only | Death detection, account bans, journal, diagnostics, Discord notifications with the available reason, and the optional Enforcer whitelist. |
| Server and clients | Adds client death-reason reports, chat announcements and on-screen banners. |
Install the same version on the server and all clients for the full feature set. Announcement RPCs changed in 1.2.1; older clients cannot display the new broadcasts.
If you previously installed the separate ValheimSteamWhitelist.dll, remove it after installing the combined mod to avoid an additional independent admission check. Install ValheimEnforcer on the server if you want to use the whitelist. Without a client reason report, the server records an unknown reason and the public message uses the generic death sentence. The local-world host's reason is read directly.
Configuration
Created after the first launch:
BepInEx/config/com.xtasy.ValheimDeathBan.cfg
[General]
Enabled = true
KickDelaySeconds = 3
BanAdmins = false
ScanIntervalSeconds = 0.25
[Announcements]
Chat = true
Banner = true
BannerSeconds = 8
BannerFontSize = 60
[Enforcer]
IntegrationEnabled = false
WhitelistEnabled = false
WhitelistExemptAdmins = true
[Discord]
Enabled = false
WebhookUrl =
[Diagnostics]
Enabled = true
LogIntervalMinutes = 15
| Setting | Default | Description |
|---|---|---|
| General.Enabled | true | Enable server death processing and bans. |
| General.KickDelaySeconds | 3 | Delay after death detection before applying the ban and disconnecting. |
| General.BanAdmins | false | Exempt accounts in adminlist.txt when false. |
| General.ScanIntervalSeconds | 0.25 | Seconds between server scans; range 0.05–30. |
| Announcements.Chat | true | Server broadcasts shout-style chat death announcements to modded clients. |
| Announcements.Banner | true | Server broadcasts red death banners to modded clients. |
| Announcements.BannerSeconds | 8 | Banner duration on each client, clamped to 1–60 seconds. |
| Announcements.BannerFontSize | 60 | Client-local maximum banner font size; range 16–120. Long messages can shrink to half this value. |
| Enforcer.IntegrationEnabled | false | Enable the optional integration with a loaded ValheimEnforcer plugin. |
| Enforcer.WhitelistEnabled | false | Only allow Steam accounts present in Enforcer’s character database; requires active integration and Enforcer. |
| Enforcer.WhitelistExemptAdmins | true | Exempt native adminlist accounts from this mod’s whitelist. |
| Discord.Enabled | false | Enable server-side webhook notifications. |
| Discord.WebhookUrl | empty | Discord webhook URL; empty disables sending. |
| Diagnostics.Enabled | true | Enable server scan timing and periodic diagnostic logs. |
| Diagnostics.LogIntervalMinutes | 15 | Minutes between diagnostic reports; range 0.1–1440. |
Existing values are preserved when updating. If your old configuration has BanAdmins = true, change it to false to enable admin immunity. Immunity does not remove existing bans.
Save the configuration file to apply changes automatically, normally within 1–2 seconds while the game or server is running. The file is checked once per second and reloaded on the main thread after its modification time and size stabilize. Read failures are logged and retried after 10 seconds.
This reload applies only to com.xtasy.ValheimDeathBan.cfg, not to Enforcer or other mods. Each installation reads its own file; settings are not synchronized between server and clients. Banner duration and font size are client-local; the server controls whether announcements are broadcast. Font size changes apply to the next banner. Whitelist changes affect subsequent connection attempts, not players already connected.
Set BannerFontSize = 60 for the original 30–60 automatic sizing range. A value of 100 allows sizing from 50 to 100. The banner area grows for larger fonts.
A larger scan interval reduces check frequency but increases death-detection latency. Synchronization delay also affects detection. The disconnect delay starts when death is detected, not at the exact moment of the client's death.
Death messages
Death-message sentence templates remain Russian. Creature names in chat and banners depend on each recipient’s game language: Russian when the language is Russian, English for every other language. Discord uses the server’s selected game language; if no language is available, creature names use English. Character names are inserted as-is, without grammatical declension.
| Cause | Example |
|---|---|
| Creature attack, Russian client | Древний убивает Дэнчик |
| Creature attack, any other client language | The Elder убивает Дэнчик |
| Player attack | Игрок Вася убил игрока Дэнчик |
| Player attack, missing killer name | Неизвестный игрок убил игрока Дэнчик |
| Falling | Дэнчик разбился |
| Falling tree | Дерево придавило Дэнчик |
| Drowning | Дэнчик утонул |
| Poison | Дэнчик отравился |
| Freezing | Дэнчик замёрз |
| Fire / cinder fire | Дэнчик сгорел |
| Other or unknown causes | Дэнчик усоп |
Russian and English creature dictionaries start empty and are populated from the game’s localization tables after those resources are ready. No hardcoded creature-name list is maintained. If loading fails, the mod logs a warning and retries no more frequently than every 10 seconds.
Missing creature translations use Неизвестное существо or Unknown creature. Already localized names from a client may also be used. Custom creature translations are available when their tables are included in the game’s localization settings; translations injected only into a global localization instance by another mod may be unavailable.
On success, the log reports: Loaded N Russian and M English creature names from game localization.
Chat announcements use shout-style rendering and are broadcast to all clients with the mod, without a distance restriction. Banners appear near the top of the screen in red with a black outline. Multiple deaths are queued; at most 100 banners wait in the queue, and the oldest waiting entry is dropped if it overflows. If the Norse font asset is unavailable, the game's message font is used instead.
Admin and local-host deaths are also announced. Disable overlapping death notifications in PvP Tweaks if you use both mods.
Enforcer Steam whitelist
The whitelist is disabled by default. To enable it on the server:
[Enforcer]
IntegrationEnabled = true
WhitelistEnabled = true
WhitelistExemptAdmins = true
The check uses Enforcer’s character account registry and supports its YAML and internal storage modes. It compares the connection’s Steam account ID, not the character name. Plain Steam IDs and Steam_-prefixed IDs are normalized. This is a Steam whitelist; accounts from other platforms do not pass an active check.
| State | Behaviour |
|---|---|
| Integration disabled or whitelist disabled | No Enforcer whitelist check. |
| Enforcer not loaded | Check inactive; a warning is logged on a connection attempt. |
| Enforcer loaded and account present | This mod allows the normal admission process to continue. |
| Enforcer loaded and account absent | Connection rejected. |
| Enforcer database empty | Remote accounts rejected, except exempt administrators. |
| Enforcer API/database check fails | Connection rejected and the error logged, except exempt administrators. |
With WhitelistExemptAdmins = true, accounts in the native adminlist.txt bypass this mod’s whitelist. Set it to false to require them to be present in Enforcer’s database too. This exemption does not bypass native bans, passwords or Enforcer’s own checks. BanAdmins controls death-ban immunity separately. The local-world host does not go through the remote admission procedure.
To populate a new database, leave WhitelistEnabled = false while participants join and Enforcer saves their characters. Then enable the whitelist. Unknown accounts cannot register themselves through a connection that the whitelist rejects. Being present in Enforcer’s database does not remove an account’s existing native ban.
Rejected attempts are appended to:
BepInEx/config/ValheimDeathBan/whitelist_rejections.txt
Entries contain the server-local timestamp, player name when available, account ID and rejection reason. The whitelist is independent of General.Enabled, which controls death processing.
Discord
Create a webhook for a Discord text channel and configure it on the server:
[Discord]
Enabled = true
WebhookUrl = https://discord.com/api/webhooks/ID/TOKEN
Notifications include the death sentence, account ID, death-detection timestamp with the server's time-zone offset, and ban outcome. Exempt administrators and local-world hosts are identified as exempt. Ban failures are reported as errors rather than successful bans.
The webhook URL is not synchronized to clients. Keep it private and exclude it from published packages and shared configuration files.
Delivery runs asynchronously through a bounded queue with a 10-second request timeout and limited retries for Discord rate limits. Discord errors do not prevent death logging or bans. Mentions are disabled. Pending notifications are not persisted and can be lost when the process stops. Ordinary network failures are not retried automatically to avoid uncertain duplicate deliveries.
Death journal
BepInEx/config/ValheimDeathBan/deaths.txt
The append-only UTF-8 journal includes server-local timestamps with time-zone offsets, names, account IDs, raw reasons, sources and exemption flags. Public message wording does not replace the detailed reason in this file. Raw creature names may be localization keys such as $enemy_troll.
Admin deaths are logged even when exempt. Local-host entries use id=local-host and source=local host (ban exempt).
Diagnostics
Server diagnostics are written to BepInEx/LogOutput.log, every 15 minutes by default. Reports include:
- Last, average and maximum full-scan times in milliseconds.
- Player-list traversal times.
- Combined ZDO lookup and death-flag read times per scan.
- Scan counts, scan failures, player counts, tracked characters and lookup/read counts.
The full-scan measurement excludes the delay between scans and asynchronous Discord delivery. Previously connected characters remain tracked for up to 30 seconds, so the tracked-character count may exceed the connected-player count.
Set Diagnostics.Enabled = false to disable timing measurements and diagnostic reports. Death detection continues to run. The first report appears after the configured interval; statistics reset after each report and when entering a new world.
Managing bans
Death bans use Valheim's standard bannedlist.txt together with administrative bans. Use the game's standard ban management to remove them. Disabling or uninstalling this mod does not remove previous bans.
Custom deathban list, deathban unban and deathban clear commands are not implemented.
Detection and limitations
The server binds connected accounts to character ZDO IDs and periodically reads s_dead. Each detected dead character is processed once. Previous character bindings remain tracked for 30 seconds after character changes or disconnection to allow delayed synchronization. A missing ZDO is not treated as a death.
Client reports provide reasons only and do not initiate bans. However, character state still arrives through game synchronization: this mod is not an anti-cheat system or independent proof of death. Delayed or missing synchronization can delay or prevent detection.
Damage-over-time deaths may lose the original attacker. A zero-second disconnect delay may prevent a reason report from arriving in time. The local-world host is always exempt regardless of BanAdmins.
Targets BepInEx 5 and .NET Framework 4.7.2. Developed against supplied Valheim game assemblies; compatibility with future game versions and other mod combinations is not guaranteed.
Updating from older versions
Replace the DLL on the server and clients and restart once to load the new code. Later configuration edits are reloaded automatically. Existing configuration values are preserved; new settings receive their defaults.
Remove the standalone ValheimSteamWhitelist.dll when switching to the combined mod. Computer-name reporting and machine checks were removed in 1.2.5. An old [MachineCheck] section is ignored and may be deleted manually. Existing machines.txt journals are not deleted, and the mod no longer writes them.
Русский
Банится аккаунт, а не отдельный персонаж. Мод обнаруживает смерть по серверному s_dead в ZDO. Клиентский мод нужен для причины смерти, чата и красного баннера. Баны сохраняются в общем bannedlist.txt сервера.
General.BanAdmins = false освобождает администраторов от бана после смерти. Их смерти всё равно записываются и объявляются. Хозяин локального мира всегда освобождён от бана.
Белый список включается только при загруженном Enforcer и двух настройках Enforcer.IntegrationEnabled = true и Enforcer.WhitelistEnabled = true. Он пропускает SteamID из базы персонажей Enforcer. Enforcer.WhitelistExemptAdmins = true отдельно освобождает администраторов от этой проверки. Без Enforcer белый список не работает. При доступной пустой базе вход запрещён, кроме освобождённых администраторов.
Имена мобов берутся из игровых таблиц: на русском клиенте — русские, на любом другом — английские. Остальные фразы остаются русскими. Для PvP: «Игрок Вася убил игрока Дэнчик».
Размер баннера: Announcements.BannerFontSize, диапазон 16–120, по умолчанию 60. Длинные сообщения уменьшаются до половины заданного размера. Настройка локальная для клиента.
Изменения конфига этого мода подхватываются обычно за 1–2 секунды после сохранения. Настройки серверов и клиентов не синхронизируются. Изменения размера шрифта действуют со следующим баннером, белого списка — при следующем подключении.
Журнал смертей: BepInEx/config/ValheimDeathBan/deaths.txt. Отказы белого списка: BepInEx/config/ValheimDeathBan/whitelist_rejections.txt. Проверка имени компьютера удалена.