
Custom Server Data
A useful mod for Minecraft servers and framework for mod developers.
About this Mod
Custom Server Data
Overview
Custom Server Data is a Fabric server-side library mod that provides a structured, persistent global data framework for Minecraft 1.20.6. It allows mod developers (and the server itself) to store data.
Data is stored as human-readable JSON files inside the world save directory:
world/customserverdata/<modid>/<filename>.json
Each variable is defined with a type, default value, constraints, and nullability through a schema system, then read/written at runtime through a static API.
Developer Guide
1. Creating a Custom Type
Any custom object you want to store must implement IJsonSerializable:
import com.google.gson.JsonObject;
import fr.hdi.api.IJsonSerializable;
public class QuestData implements IJsonSerializable {
private int nbPoints;
private String status;
public QuestData() {
this.nbPoints = 0;
this.status = "inactive";
}
public int getNbPoints() { return nbPoints; }
public void setNbPoints(int nbPoints) { this.nbPoints = nbPoints; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
@Override
public JsonObject toJson() {
JsonObject json = new JsonObject();
json.addProperty("nb_points", nbPoints);
json.addProperty("status", status);
return json;
}
@Override
public void fromJson(JsonObject json) {
this.nbPoints = json.has("nb_points") ? json.get("nb_points").getAsInt() : 0;
this.status = json.has("status") ? json.get("status").getAsString() : "inactive";
}
}
2. Registering Data
Register your schemas in your mod's onInitialize method using ServerSchemaManager:
import fr.hdi.schema.ServerDataType;
import fr.hdi.schema.ServerSchemaManager;
import fr.hdi.schema.ServerVariableDefinition;
import net.fabricmc.api.ModInitializer;
public class MyMod implements ModInitializer {
public static final String MOD_ID = "mymod";
@Override
public void onInitialize() {
// Register an integer with min/max constraints
ServerSchemaManager.register(MOD_ID, "quests",
ServerVariableDefinition.builder("nb_point")
.type(ServerDataType.INT)
.defaultValue(10)
.min(0)
.max(1000)
.build()
);
// Register a string
ServerSchemaManager.register(MOD_ID, "quests",
ServerVariableDefinition.builder("status")
.type(ServerDataType.STRING)
.defaultValue("active")
.build()
);
// Register a boolean
ServerSchemaManager.register(MOD_ID, "settings",
ServerVariableDefinition.builder("pvp_enabled")
.type(ServerDataType.BOOLEAN)
.defaultValue(false)
.build()
);
// Register a custom type
ServerSchemaManager.register(MOD_ID, "quests",
ServerVariableDefinition.builder("quest_data", "QuestData")
.type(ServerDataType.CUSTOM)
.customFactory(Questdata-blocked::new)
.nullable(true)
.build()
);
//Register a custom type List
ServerSchemaManager.register(MOD_ID, "warps",
ServerVariableDefinition.builder("warps")
.type(ServerDataType.LIST)
.elementType(ServerDataType.CUSTOM)
.elementFactory(Warp::new)
.defaultValue(List.of())
.build()
);
}
}
This produces two JSON files on disk:
world/customserverdata/mymod/quests.jsonworld/customserverdata/mymod/settings.json
3. Reading / Writing Data
Use the static ServerDataStore API anywhere on the server thread:
import fr.hdi.store.ServerDataStore;
// Read values
int points = ServerDataStore.getInt("mymod", "quests", "nb_point");
String status = ServerDataStore.getString("mymod", "quests", "status");
boolean pvp = ServerDataStore.getBoolean("mymod", "settings", "pvp_enabled");
// Write values (validated against the schema)
ServerDataStore.setData("mymod", "quests", "nb_point", 42);
ServerDataStore.setData("mymod", "quests", "status", "completed");
ServerDataStore.setData("mymod", "settings", "pvp_enabled", true);
// Custom objects
QuestData quest = ServerDataStore.getCustom("mymod", "quests", "quest_data");
if (quest != null) {
quest.setNbPoints(100);
ServerDataStore.setData("mymod", "quests", "quest_data", quest);
}
List<Warp> warps = ServerDataStore.getList(EssentialsUtilsCommands.MOD_ID, "warps", "warps");
if (warps != null){
warps.remove(1);
ServerDataStore.setData(EssentialsUtilsCommands.MOD_ID, "warps","warps",warps);
}
Available Versions
How to Install Custom Server Data on Your Server
Order Server
Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).
Set fabric Loader
In the panel under "Egg", select the fabric loader and matching Minecraft version (1.20.6).
Install Mod
Open the mod browser in the dashboard and search for "Custom Server Data". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.
Compatibility
Mod Loaders
Minecraft Versions
1.20.6
Server-side
✓ RequiredRecommended RAM
4 GB(min. 3 GB)Frequently Asked Questions
Custom Server Data server crashes on startup – what to do?
Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.20.6). You can switch loaders with one click in the panel.
Is Custom Server Data compatible with fabric and quilt?
Custom Server Data officially supports fabric, quilt for Minecraft 1.20.6. The Mado dashboard automatically detects incompatible loader combinations.
Server lagging with Custom Server Data – how to optimize performance?
Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Custom Server Data consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.
Similar Mods
Rent Modded Server
Install Custom Server Data with just one click on your server.