Server Wipe System Documentation
The Server Wipe system in VAMP provides functionality to handle server wipes and mod data persistence between server sessions.
Overview
The wipe system consists of:
- A dedicated
_WipeData
folder for mod persistence - Automatic wipe detection on server startup
- Events to notify mods when wipes occur
- Configuration options for server admins
For Server Admins
_WipeData Folder
The system creates a _WipeData
folder in your BepInEx config directory. This folder:
- Stores mod persistence data between server sessions
- Contains a README.txt explaining its purpose
- Is automatically cleaned during server wipes (if enabled)
Configuration
In your VAMP.cfg file:
AutoWipeDetection
: Controls whether VAMP automatically deletes mod data during wipesStartDateFile
: Path to the file containing the server start date
Performing a Wipe
- Stop your server
- Delete your save data as normal
- Start the server
- VAMP will automatically:
- Detect the fresh server state
- Clear mod persistence data (if AutoWipeDetection is enabled)
- Notify mods of the wipe
For Modders
Wipe Detection
VAMP detects wipes by checking:
- The server start date file
- If the date matches today
- If there are no cached users
Wipe Events
Subscribe to the wipe event to handle server wipes:
Events.OnServerWiped += (autoWiped) => {
if (autoWiped) {
// VAMP automatically cleared _WipeData
// Initialize fresh mod state
} else {
// Manual wipe handling required
// Check/clear your mod's persistence files
}
};
Using _WipeData
Store persistence files in the _WipeData
directory:
string modDataPath = Path.Combine(FilePaths.WipeData, "mymod-data.json");
// Save data
File.WriteAllText(modDataPath, JsonSerializer.Serialize(data));
// Load data
if (File.Exists(modDataPath)) {
data = JsonSerializer.Deserialize<MyData>(File.ReadAllText(modDataPath));
}
Best Practices
- Always handle both automatic and manual wipe scenarios
- Use the
_WipeData
folder for any data that should persist between server sessions - Subscribe to
OnServerWiped
beforeOnCoreLoaded
to ensure proper initialization - Include version information in your persistence files
- Handle missing or corrupt persistence files gracefully