# Your first integration

> Write a plugin class and a service file so Settings Saver saves and syncs your mod's config file, then check that the file reaches a profile.

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

By the end of this page Settings Saver knows your mod's config file, saves it into a profile and gives
it to new instances.

## Prerequisites

- [Installation](https://xichil.dev/docs/settings-saver/v1/getting-started/installation/index.md) done: the API is a `compileOnly` dependency.
- A mod with a settings file inside the game directory. The examples use `config/mymod.properties`:

```properties title="config/mymod.properties"
renderDistance=12
showHud=true
windowX=120
```

## Steps

### 1. Create the plugin class

Make a class of its own that implements
[SettingsSaverPlugin](https://xichil.dev/javadoc/settings-saver/v1/dev/xichil/settingssaver/api/v1/SettingsSaverPlugin.html). Settings Saver calls
its `register` method once, early in the launch.

```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)
                .build());
    }
}
```

The class must be public, have a public no-argument constructor (the default one is fine) and be a
top-level class or a static nested class.

### 2. Describe your settings

Everything Settings Saver needs is in the
[ModSettings](https://xichil.dev/javadoc/settings-saver/v1/dev/xichil/settingssaver/api/v1/ModSettings.html) you build:

| Part | In the example | Meaning |
| --- | --- | --- |
| mod id | `"mymod"` | Your mod id as your loader knows it. It names your folder in every profile, so never change it. |
| display name | `"My Mod"` | The name players see in Settings Saver. |
| mod version | `"2.1.0"` | The running version of your mod. Recorded with every save. |
| file | `"config/mymod.properties"` | A path relative to the game directory. |
| format | `SettingsFileFormats.PROPERTIES` | How the file is read: here `key=value` lines, so settings sync one by one. |

At least one `file` or `directory` is required. Everything else is optional and covered in the guides.

### 3. List the class in a service file

Create a text file named after the plugin interface, containing the full name of your class:

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

The file must end up at `META-INF/services/dev.xichil.settingssaver.api.v1.SettingsSaverPlugin` inside
your mod's jar. Settings Saver finds it with `java.util.ServiceLoader`. When Settings Saver isn't
installed, nothing reads the file, so your plugin class is never loaded.

### 4. Keep the plugin class isolated

The plugin class is the one place in your mod that references the API.

- Don't reference `MyModSettingsSaver` from your other classes.
- Inside it, don't touch Minecraft classes, don't load your config and don't do slow work. It runs during
  startup, possibly before the game or your mod is set up. Build a `ModSettings` and hand it over.

### 5. Decide whether it is on by default

As written above, your mod is listed in Settings Saver but **nothing is saved** until the player turns
your mod on for a profile. To have it saved without that step, add `.savedByDefault(true)`:

```java
registrar.register(ModSettings.builder("mymod", "My Mod", "2.1.0")
        .file("config/mymod.properties", SettingsFileFormats.PROPERTIES)
        .savedByDefault(true)               // leave this out to stay off until the player turns it on
        .excludedByDefault("windowX")       // this key stays per instance
        .build());
```

Only do that when the settings clearly belong to the player and not to a modpack. See
[Set what is saved by default](https://xichil.dev/docs/settings-saver/v1/guides/defaults/index.md).

## Check it worked

1. Build your mod and put the jar into an instance that has Settings Saver installed.
2. Start the game and search the log for `[Settings Saver] Registered`. You should see:

```text
[Settings Saver] Registered My Mod (mymod 2.1.0): [config/mymod.properties], not saved unless turned on in a profile
```

   With `.savedByDefault(true)` the line ends in `saved by default`.

3. If your mod is not saved by default, close the game and turn it on for the profile: add
   `enabled.mymod=true` to `profiles/default/profile.properties` in the Settings Saver store (the
   [wiki](https://xichil.dev/wiki/settings-saver/v1/guides/other-mods/index.md) shows players how). Start the game again.
4. Open **Options**, **Settings Saver...** and press **Save settings to profile**.
5. Look in the store. Your file is there, next to a `module.txt` that records the versions it was saved in:

```text
profiles/default/mymod/config/mymod.properties
profiles/default/mymod/module.txt
```

6. Create a new instance with both mods and start it. Its `config/mymod.properties` now holds the saved
   settings.

No `Registered` line? See [Fix an integration that doesn't sync](https://xichil.dev/docs/settings-saver/v1/guides/debugging/index.md).

## Next steps

- [Register files and directories](https://xichil.dev/docs/settings-saver/v1/guides/files-and-directories/index.md): more files, whole folders.
- [Choose a file format](https://xichil.dev/docs/settings-saver/v1/guides/choosing-a-format/index.md): what "key by key" changes.
- [Read your config after the restore](https://xichil.dev/docs/settings-saver/v1/guides/reading-your-config/index.md): where to load your config so a
  new instance sees the saved file on every loader.
- [A properties config](https://xichil.dev/docs/settings-saver/v1/examples/properties-config/index.md): this integration as a complete example.
