# How syncing works

> What Settings Saver does with a registered settings file, from the launch restore to key-by-key saving, and where a profile stores your mod's files.

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

Settings Saver keeps one copy of your mod's settings per **profile**, outside every game instance, and
moves settings between that copy and each instance's file. It works setting by setting, so instances
don't overwrite each other.

## The pieces

| Term | Meaning |
| --- | --- |
| **Instance** | One game directory: a modpack, a launcher profile, one Minecraft version. |
| **Store** | One folder per user, shared by every instance on the computer. |
| **Profile** | A named set of saved settings in the store. Each instance picks one; `default` always exists. |
| **Registration** | Your [ModSettings](https://xichil.dev/javadoc/settings-saver/v1/dev/xichil/settingssaver/api/v1/ModSettings.html): which files, how to read them, the defaults and the fixes. |
| **Format** | Reads a file into a flat `key -> value` map and writes it back. |

## What happens to a registered file

```text
            launch                        while playing                    on demand
  profile ----------> instance file    instance file ----------> profile   Save / Load buttons
  (only if the file is missing,        (only the keys that changed,
   or sync is Auto + always apply)      only when sync is Auto)
```

### 1. Registration

Your plugin hands over a `ModSettings` early in the launch. Settings Saver checks it against the other
registrations and, if the profile has your mod turned on, starts syncing its files.

### 2. Restore at launch

For each of your files:

- If the instance **doesn't have the file**, it is written from the profile's copy, converted to this
  instance's Minecraft version.
- If the instance has the file, it is left alone. The exception is the sync mode **Auto + always apply**,
  which backs the file up and applies the profile over it at every launch.

With sync **Off** (the default), this restore happens once per instance, on its first launch with
Settings Saver. With **Auto**, it happens whenever a file is missing at launch.

An empty profile restores nothing, and an instance never fills a profile on its own.

### 3. Saving changes

Settings reach the profile in two ways:

- **Save settings to profile**, the button in Settings Saver's menu, in every sync mode.
- **Auto sync**: a background thread checks your file every 2 seconds. Once the file has changed and then
  stayed the same for one more check, the changes are saved. A final check runs when the game closes.

Either way, with a key-by-key format only the settings that **changed** since the last sync are written.
The rest of the profile's copy stays as it is. Two instances that changed different settings both keep
their change.

A setting that newly appears in your file (your mod added it with its default) only fills a gap in the
profile. It never replaces a value that is already saved there.

### 4. Loading

**Load settings from profile** backs up the instance's file, then merges the profile's values over it.
Keys the profile excludes, or doesn't have, keep the instance's values.

## Key by key, or as a whole

Everything above works per key, as your format defines keys. With the default `WHOLE_FILE` format the
file has a single key, `content`, so:

| | Key-by-key format | `WHOLE_FILE` |
| --- | --- | --- |
| A save writes | the changed keys | the whole file, when anything changed |
| Two instances change the file | both changes kept, per key | the newest save wins |
| A load | merges over the instance's file | replaces the instance's file |
| Exclusions | per key | only the whole file |

See [Choose a file format](https://xichil.dev/docs/settings-saver/v1/guides/choosing-a-format/index.md).

## Off unless chosen

A registered mod is listed in Settings Saver, but its files are synced for a profile only when:

- the player turned the mod on for that profile (`enabled.<mod id>=true`), or
- the mod asked for [`savedByDefault(true)`](https://xichil.dev/docs/settings-saver/v1/guides/defaults/index.md) and the player didn't turn it off.

Turning a mod on or off applies nothing by itself: syncing starts from the instance's current files, and
turning it off leaves what the profile has saved.

## Where a profile keeps your files

```text
<store>/
  profiles/
    default/
      profile.properties                 enabled.mymod=, exclude.mymod=, and the same for other mods
      vanilla/options.txt                Minecraft's own settings
      mymod/
        module.txt                       modVersion and dataVersion the settings were saved in
        config/mymod.properties          your file, at its path in the game directory
```

- Your folder is named after your **mod id**. Change the id and your mod starts from an empty folder.
- The profile's copy is written with the same format as your file.
- `module.txt` is what lets another version convert the settings. See
  [How settings are converted](https://xichil.dev/docs/settings-saver/v1/concepts/version-conversion/index.md).
- Backups of files that a Load or **Auto + always apply** replaced go to `<store>/backups/<mod id>/`.

## Several instances at once

Instances that run at the same time share the store. Every read-modify-write of a profile runs under a
lock that works across processes, and files are replaced atomically, so a profile is never half
written. Your format, fixes and merger may therefore be called while the profile is locked: keep them
quick.

## Related

- For players: [Sync modes](https://xichil.dev/wiki/settings-saver/v1/mechanics/sync-modes/index.md) and
  [Saving other mods' settings](https://xichil.dev/wiki/settings-saver/v1/guides/other-mods/index.md).
- [When plugins run](https://xichil.dev/docs/settings-saver/v1/concepts/when-plugins-run/index.md)
- [Threads and errors](https://xichil.dev/docs/settings-saver/v1/concepts/threads-and-errors/index.md)
