# Example: a properties config

> The smallest complete Settings Saver integration, for a mod with one key=value config file, with the build script, plugin class and service file.

URL: https://xichil.dev/docs/settings-saver/v1/examples/properties-config/ · Updated: 2026-11-16 · Applies to: Fabric, Quilt, Legacy Fabric, Forge, NeoForge, MC 1.7.10 - 26.3

A mod with one `key=value` config file whose settings follow the player to every instance. Three files
are all it takes: a build script line, a plugin class and a service file.

## Files

```text
mymod/
├── build.gradle.kts
└── src/main/
    ├── java/com/example/mymod/compat/MyModSettingsSaver.java
    └── resources/META-INF/services/dev.xichil.settingssaver.api.v1.SettingsSaverPlugin
```

The mod's config file, written and read by the mod itself as before:

```properties title="config/mymod.properties"
renderDistance=12
showHud=true
hudScale=1.0
windowX=120
windowY=80
lastServer=play.example.com
```

## The build script

Add these to the build your mod already has:

```kotlin title="build.gradle.kts"
repositories {
    maven("https://maven.xichil.dev")
}

dependencies {
    // Settings Saver's own jar ships these classes. Never bundle, shade or jar-in-jar them.
    compileOnly("dev.xichil.settingssaver:settingssaver-api:1.0.0")
}
```

## The plugin class

```java title="src/main/java/com/example/mymod/compat/MyModSettingsSaver.java"
package com.example.mymod.compat;

import dev.xichil.settingssaver.api.v1.ModSettings;
import dev.xichil.settingssaver.api.v1.SettingsFileFormats;
import dev.xichil.settingssaver.api.v1.SettingsSaverPlugin;
import dev.xichil.settingssaver.api.v1.SettingsSaverRegistrar;

/** Only Settings Saver loads this class. Nothing else in the mod may reference it. */
public final class MyModSettingsSaver implements SettingsSaverPlugin {
    @Override
    public void register(SettingsSaverRegistrar registrar) {
        registrar.register(ModSettings.builder("mymod", "My Mod", "2.1.0")
                .file("config/mymod.properties", SettingsFileFormats.PROPERTIES)
                .savedByDefault(true)
                .excludedByDefault("windowX", "windowY", "lastServer")
                .build());
    }
}
```

## The service file

```text title="src/main/resources/META-INF/services/dev.xichil.settingssaver.api.v1.SettingsSaverPlugin"
com.example.mymod.compat.MyModSettingsSaver
```

## How it works

| Line | Effect |
| --- | --- |
| `builder("mymod", "My Mod", "2.1.0")` | The mod id names the folder in each profile. The name is shown to players. The version is recorded with every save. |
| `.file("config/mymod.properties", SettingsFileFormats.PROPERTIES)` | The file is read as `key=value` lines, so each setting syncs on its own. |
| `.savedByDefault(true)` | Profiles save the file without the player turning the mod on. Leave it out if your settings usually belong to a modpack. |
| `.excludedByDefault("windowX", "windowY", "lastServer")` | These keys stay with each instance: they are never saved to or loaded from a profile. |

## What the player gets

After the player presses **Save settings to profile** once (or turns on auto sync), the profile holds:

```properties title="<store>/profiles/default/mymod/config/mymod.properties"
renderDistance=12
showHud=true
hudScale=1.0
```

`windowX`, `windowY` and `lastServer` are not there. A new instance that starts with the mod gets this
file as its `config/mymod.properties`, and the mod fills in its own defaults for the three missing keys.

> **Note:** `PROPERTIES` doesn't write comments back. If your mod's file has comments, they are gone after a profile
> is loaded into it, until your mod writes the file again. See
> [Choose a file format](https://xichil.dev/docs/settings-saver/v1/guides/choosing-a-format/index.md#properties).

## Variations

| You want | Change |
| --- | --- |
| off until the player turns it on | remove `.savedByDefault(true)` |
| keep the file exactly, comments included | `.file("config/mymod.properties")` without a format |
| a second file | another `.file(...)` call |
| every file in `config/mymod/` | `.directory("config/mymod")` |

## Related

- [Your first integration](https://xichil.dev/docs/settings-saver/v1/getting-started/first-integration/index.md): the same steps, explained one by one.
- [Set what is saved by default](https://xichil.dev/docs/settings-saver/v1/guides/defaults/index.md)
