DoNotTheHammer
Only the player who placed a build piece can remove or damage it. Protects a prebuilt world from accidental demolition and unwanted recipe unlocks.DoNotTheHammer
Only the player who placed a build piece can remove or damage it.
Built for people who prepared a world in advance — a spawn town, a quest dungeon, a shared hub, a progression-gated base — and do not want it dismantled by a guest with a hammer.
Works retroactively on worlds you already built. Nothing needs tagging or migrating.
Built and verified against Valheim 1.0 (Unity 6000.0.75) and BepInEx 5.4.2350.
How it works
Valheim already records which character placed every build piece, in the object's networked save record. This mod reads that value and enforces a rule on it. Because the data is already in your world file, protection applies to everything you have ever built, immediately.
The creator is a character, not a Steam account. Two characters on the same account have different IDs, so your dedicated builder character is distinguishable from the character you play.
Installation
Install on the server and on every client.
Clients matter because Valheim gives object ownership to whichever machine is nearby, so a player without the mod can still act on objects their own game owns. See Limitations.
Using a mod manager (r2modman / Thunderstore Mod Manager), just install the package. Manually, drop
the DLL into BepInEx/plugins/.
Setup
Nothing is protected until you configure it. Out of the box the protected list is empty, so installing the mod changes nothing at all.
-
Load your world, stand in the middle of the build you want to protect.
-
Open the console with
F5and run:cprot scanThis counts loaded build pieces by creator. The ID with by far the most pieces is your builder.
-
Protect it:
cprot add 123456789 -
Confirm with
cprot list. -
Set the same ID in the server's config and restart the server. Config does not sync between machines.
Alternatives for finding the ID: cprot look reports the creator of the piece under your crosshair,
and cprot id prints the ID of the character you are currently playing.
Console commands
| Command | Does |
|---|---|
cprot id |
Print the character ID you are playing as |
cprot look |
Print the creator ID of the piece under your crosshair |
cprot scan |
Count loaded pieces per creator, marking which are protected |
cprot list |
Show current settings |
cprot add <id> |
Start protecting pieces built by that character |
cprot remove <id> |
Stop protecting that character |
Configuration
The config file is BepInEx/config/creatorprotect.cfg, created on first launch. It can also be
edited live in game with BepInEx ConfigurationManager (F1).
Who is protected
| Setting | Default | Meaning |
|---|---|---|
ProtectedCreatorIds |
empty | Comma-separated character IDs whose pieces are protected. This is the main setting. |
ProtectAllCreators |
false |
Protect every piece from everyone except whoever placed it. Ignores the list above. Also stops players wrecking each other's builds. |
BypassPlayerIds |
empty | Characters allowed through regardless. Put your admin character here so you can still make repairs. |
ProtectUnownedPieces |
false |
Also protect pieces with creator ID 0. Those are usually world-generated structures, so this protects a great deal. |
What is blocked
| Setting | Default | Meaning |
|---|---|---|
BlockRemoval |
true |
Block hammer deconstruction. This is the setting that stops material refunds, and therefore unintended recipe unlocks. |
BlockPlayerDamage |
true |
Block pickaxe, weapon, stray arrow and fire damage from players. |
BlockAllDamage |
false |
Block enemies, raids, weather and decay too. Leave off to keep trolls dangerous. |
BlockResourceDrops |
true |
Protected pieces drop no materials unless their own creator removed them. In 1.0 a piece destroyed by damage still drops its resources, so without this an enemy smashing a wall would hand out materials the players should not have yet. |
PreventCollapse |
true |
Protected pieces ignore lost structural support, so someone removing their own piece cannot bring a protected build down. |
ServerEnforcement |
true |
Also reject removal requests arriving over the network. On a dedicated server this covers players without the mod, for objects the server owns. |
Limitations
Please read these before relying on the mod.
- Object ownership is distributed. Valheim hands ownership to whichever machine is nearby. When
a player's own game owns the object, the removal executes there, so a client without the mod can
still remove things.
ServerEnforcementonly covers objects the server owns. The reliable answer is for everyone to install it. This mod does not disconnect players who lack it. - Back up your builder's character file. The creator ID lives in that character profile
(
AppData/LocalLow/IronGate/Valheim/characters/*.fch). Delete and recreate that character and the new one gets a different ID, at which point its pieces become unremovable by everyone until you update the config. It fails in the safe direction, but back it up. - Creator ID 0. A piece placed while the client did not own the object records no creator. If
cprot scanshows a large count under creator0, those are unprotected unless you enableProtectUnownedPieces, which also covers world-generated structures. - Wards (
PrivateArea) still apply first and are unaffected.
Compatibility
Should coexist with other building mods. It adds no new pieces, changes no prefabs, and only vetoes
actions — it patches Player.CheckCanRemovePiece, WearNTear.Remove, WearNTear.RPC_Remove,
WearNTear.ApplyDamage, WearNTear.HaveSupport and Piece.DropResources.
Mods that remove pieces through their own code paths (some admin build tools) may bypass the hammer check, though the damage, drop and support patches still apply.
Credits
Inspired by the late BuildingProtection by KhaibaGaming, which used a toggled build mode rather
than creator tracking, and which does not work on Valheim 1.0.
