Source-checkedAdmin & protection

serverpermadeath

by 1010101110 · for Valheim

Server side only. Records deaths and bans characters when they die.

995Downloads
3 yr agoLast updated
BepInExLoaders
ThunderstoreSource

About serverpermadeath

From Thunderstore

Server side only. Records deaths and bans characters when they die.

serverpermadeath

this mod runs on the server only. The goal of this mod is to give server authority / no client mod solution to permadeath. We don't want to use the originally bannedlist.txt because that will ban a player all together. We want players to continue playing, they just can't use a character that has died.

new server textfile permadeath.txt

Server checks for dead players. if a player dies:

  • adds steamid|charactername to permadeath.txt
  • shout that player has died
  • start a 30 sec timer giving them time to say goodbye
  • kicks them, shows Banned popup

Server checks permadeath.txt and all players connected. if player|charactername is on list:

  • kicks them, shows Banned popup

Combine this with servercharacters https://valheim.thunderstore.io/package/Smoothbrain/ServerCharacters/ to have a hardcore server

install

prerequisite: have bepinex installed on server

drag serverpermadeath.dll into bepinex/plugins folder

restart server

code

 public static SyncedList characterbans;
public static Dictionary<string, int> timers = new Dictionary<string, int>();

//initialize the synced list used for tracking bans
[HarmonyPatch(typeof(ZNet), "Awake")]
public static class awakepatch{
    private static void Postfix()
    {
        characterbans = new SyncedList(Utils.GetSaveDataPath(FileHelpers.FileSource.Local) + "/permadeath.txt",
        "List of dead players by steamid|charname - ONE per line - serverpermadeath mod");
    }
}



[HarmonyPatch(typeof(ZNet), "CheckWhiteList")]
public static class CheckCharWhitelist
{
    private static bool Prefix(ZNet __instance)
    {
        //runs every 5s
        //check whitelist
        if (__instance.m_peers != null)
        {
            if (__instance.m_peers.Count > 0)
            {
                foreach (ZNetPeer znetPeer in __instance.m_peers.ToList<ZNetPeer>())
                {
                    if (znetPeer.IsReady() && !znetPeer.m_characterID.IsNone())
                    {
                        string charName = znetPeer.m_playerName;
                        string id = znetPeer.m_socket.GetHostName();
                        string idandname = id + "|" + charName;
                        bool bannedalready = characterbans.Contains(idandname);

                        //they are banned, gtfo
                        if (bannedalready)
                        {
                            ZNet.instance.InternalKick(znetPeer);
                        }
                        else
                        {
                            //check if they're dead
                            ZDO zdo = __instance.m_zdoMan.GetZDO(znetPeer.m_characterID);
                            if (zdo != null)
                            {
                                bool dead = zdo.GetBool("dead", false);

                                if (dead && !TrippingPatches.timers.ContainsKey(idandname))
                                {
                                    //tell everyone they are dead
                                    ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", new object[]
                                    {
                                    znetPeer.m_refPos,
                                    2,
                                    znetPeer.m_playerName,
                                    znetPeer.m_playerName + " has been slain"
                                    });
                                    ZLog.Log(znetPeer.m_playerName + " DIED " + znetPeer.m_refPos.ToString());

                                    //start a timer to kick them
                                    TrippingPatches.timers.Add(idandname, 5);
                                }
                            }
                        }
                    }
                }
            }
        }

        //clean up the timers
        foreach (string key in TrippingPatches.timers.Keys.ToList<string>())
        {
            TrippingPatches.timers[key] = TrippingPatches.timers[key] - 1;
            if (TrippingPatches.timers[key] < 0)
            {
                //add them to the banned list
                characterbans.Add(key);

                //remove the timer
                TrippingPatches.timers.Remove(key);
            }
        }

        return true;
    }
}

Highlights

From source data

Loaders

Runs on BepInEx.

Footprint

Rated a light load on a server.

Last update

Its author last shipped an update 3 yr ago.

serverpermadeath on Nxeon

From our catalogue
One-click install
Supported on Nxeon Valheim servers, for BepInEx servers. We download it from Thunderstore, place it, and restart the server.
Server side
Required on the server
Server type needed
BepInEx
Server load
light
Smallest plan we suggest
Valheim — 4 GB (4 GB RAM). This follows our own load rating above, not a benchmark.
Latest build
1.0.0, released 2023-06-22

Game versions by loader

LoaderGame versionsNewest
BepInEx

From 2 recorded builds of serverpermadeath.

Recent builds

BuildReleasedGame versionsLoaders
1.0.02023-06-22n/aBepInEx
0.0.12021-02-25n/aBepInEx

Dependencies

Declared by the newest build that lists any. Required ones are installed with it on one-click installs.

Run serverpermadeath on a Valheim server

Pick a server or deploy a new one above; it is installed in one click.

What kind of mod it is

From the catalog
Listed on Thunderstore as “Content”

Admin & protection

Permissions, moderation, anti-cheat and land protection for the people running the server.

Runs on your server

From source side support

Thunderstore lists serverpermadeath as required on the server. Check its Thunderstore page to see whether players need it too.

Compatibility

Game
Valheim
Loaders
BepInEx
Runs on
Serverrequired on the server
Requires
One-click install needs a BepInEx server.

Verified at the source

  • ✓ThunderstoreOfficial listing, checked 2026-10-02Open ↗
  • ✓Author1010101110, as published on Thunderstore
  • ✓LicenseNot published by the sourceFree

serverpermadeath, answered

Generated from the mod’s own source data.

Do my players need to install serverpermadeath?

Thunderstore lists serverpermadeath as required on the server. Check its Thunderstore page to see whether players need it too.

Which loaders does it support?

BepInEx.

Is it free?

Yes. serverpermadeath is free to download from Thunderstore.

How do I add it to my Nxeon server?

Use “Add to a server” on this page, or open NxLabs from your dashboard. We install it, restart your server and switch it on.

NxLabs

Run serverpermadeath on a Valheim server.

Deploy in about a minute from $9.99 a month, then add serverpermadeath in one click.