Skip to main content

ServerWipeManager

A static class in Root.Township, the global namespace.

Server: static helpers that wipe a server's world, its caves or its whole save folder. Run from console commands and ServerHandler; a world wipe ends by quitting the server.

Fields​

2 private and internal fields
MemberWhat it is
private static bool hadIssuesSet when any wipe step fails; WipeServer then logs a fatal error and waits a minute before quitting.
private static Logger loggerNLog logger for this class.

Properties​

MemberWhat it is
static bool IsWiping { get; set; }True while a wipe is running.

Events​

MemberWhat it is
static event Action CaveWipeFired near the end of WipeCaves; the cave teleporter manager clears its teleporters on it.
static event Action WipeOperationsFinishedFired after the pre-wipe chunk operations; PostboxManager posts trade vendor refunds on it.
static event Action WipeStartingEvent the chunk physics resolver stops on. Never raised in this class in this build.

Methods​

MemberWhat it is
static async Task DeleteChunksAndCache()Server: waits for pending file writes, then deletes the chunks and cache folders.
static async Task DeleteEntireSaveFolder()Server: waits for pending file writes, then deletes the server's whole save folder.
static async Task FullWipe()Server: stops the API session, locks joins, kicks everyone, deletes the whole save folder and quits.
static async Task WipeCaves()Server: locks joins, moves online and offline players out of the caves, clears the cave system and raises CaveWipe.
static async Task WipeServer(bool isSettingOffline = false)Server: stops the session (optionally marking the server offline), kicks everyone, runs wipe operations, deletes chunks and cache, sanitizes player saves and quits.
7 private and internal methods
MemberWhat it is
private static async Task FastWipeOperations()Server: runs wipe operations on just two hard-coded chunks and posts trade refunds. Not called anywhere in this build.
private static void MigrateLockboxes()Server: moves old Personal Chunk Storage files from the chunks folder into each player's folder. Not called anywhere in this build.
private static async Task<bool> MovePlayerOutOfCaves(PlayerSave save)Moves a saved player who is outside the overworld to a random spot at the outside-cave spawn area. Used by WipeCaves.
private static async Task RunThroughAllPlayers(Func<PlayerSave, Task<bool>> saveAction)Server: loads every player save in the player folder, runs an action on it and writes it back when the action returns true.
private static async Task<bool> SanitizePlayersSaves(PlayerSave save)Moves a saved player to a random respawn point, clears their home and wipes their non-reserved map markers. Used by WipeServer.
private static async Task WipeChunk(Chunk chunk)Server: force-loads a chunk, calls WipeOperation on every entity with IOperateOnWipe, then unloads and saves it unless it's global.
private static async Task WipeOperations()Server: runs WipeChunk on every chunk WipeManager lists for pre-wipe, then raises WipeOperationsFinished.