Back to mods
Custom Server Data project artwork

CurseForge · Minecraft mod

Custom Server Data

A useful mod for Minecraft servers and framework for mod developers.

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Custom Server Data release should I use?

Updated 5 months ago
Latest stable file custom-server-data-1.0.3.jar
Game version 1.20.6
Loader Fabric, Quilt

Custom Server Data custom-server-data-1.0.3.jar targets 1.20.6 with Fabric, Quilt. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.

Where it goes

Is Custom Server Data required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Fabric, Quilt
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does Custom Server Data custom-server-data-1.0.3.jar need?

custom-server-data-1.0.3.jar. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add Custom Server Data without breaking your instance.

Built for Custom Server Data custom-server-data-1.0.3.jar. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use custom-server-data-1.0.3.jar. It targets 1.20.6 with Fabric, Quilt; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside custom-server-data-1.0.3.jar. It opens that exact file at the source.

About this project

What does Custom Server Data add?

Custom Server Data

Version Loader Status

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.DataType;
import fr.hdi.schema.ServerSchemaManager;
import fr.hdi.schema.VariableDefinition;
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",
            VariableDefinition.builder("nb_point")
                .type(DataType.INT)
                .defaultValue(10)
                .min(0)
                .max(1000)
                .build()
        );

        // Register a string
        ServerSchemaManager.register(MOD_ID, "quests",
            VariableDefinition.builder("status")
                .type(DataType.STRING)
                .defaultValue("active")
                .build()
        );

        // Register a boolean
        ServerSchemaManager.register(MOD_ID, "settings",
            VariableDefinition.builder("pvp_enabled")
                .type(DataType.BOOLEAN)
                .defaultValue(false)
                .build()
        );

        // Register a custom type
        ServerSchemaManager.register(MOD_ID, "quests",
            VariableDefinition.builder("quest_data", "QuestData")
                .type(DataType.CUSTOM)
                .customFactory(QuestData::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.json
  • world/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);
}

Project description from CurseForge.

Pick your setup

Custom Server Data by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

2 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

Custom Server Data versions and loaders

1 of 1 releases match

Looking for an older file? The official CurseForge project page is in Resources.