Settings Saver API docs

Let Settings Saver save, load and sync your mod's own settings files through its profiles, on every loader from Minecraft 1.7.10 to 26.3.

Last updated

On this page

Settings Saver keeps a player's settings in profiles outside any one game instance and applies them to every instance that uses the profile. Out of the box it handles Minecraft's options.txt. With this API your mod's own settings files are saved, loaded and synced the same way.

Settings Saver stays an optional dependency. Your mod compiles against a small API jar, and when the player doesn't have Settings Saver installed, your mod runs exactly as before.

The whole integration is one class and one text file:

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());
    }
}
src/main/resources/META-INF/services/dev.xichil.settingssaver.api.v1.SettingsSaverPlugin
com.example.mymod.compat.MyModSettingsSaver

Key facts#

Package dev.xichil.settingssaver.api.v1
Maven repository https://maven.xichil.dev
API artifact dev.xichil.settingssaver:settingssaver-api:1.0.0, as compileOnly (never bundle it)
Settings Saver's mod id settingssaver (SettingsSaverMods.MOD_ID), the same on every loader
Java the API is plain Java 8 with no dependencies: no Minecraft, loader or Settings Saver classes
Loaders and versions every one Settings Saver supports: Fabric, Quilt, Legacy Fabric, Forge and NeoForge, Minecraft 1.7.10 to 26.3
Side client only; nothing is synced on a dedicated server
Entry point a SettingsSaverPlugin class listed in a META-INF/services file
Files UTF-8 text files inside the game directory
Default a mod's settings are not saved until the player turns the mod on for a profile, unless the mod asks for savedByDefault(true)
Compatibility the v1 package only changes compatibly; a breaking change would be a new v2 package next to it
Javadoc the api.v1 package and every class in it

Start here#

  1. Installation: add the Maven repository and the compileOnly dependency.
  2. Your first integration: the plugin class, the service file, and how to check that your file reaches a profile.
  3. Build one integration for every loader: ship the same plugin class in every jar of a multi-loader, multi-version mod.

Find the page you need#

I want to… Page
sync one file, several files or a whole folder Register files and directories
sync single settings instead of whole files Choose a file format
sync a TOML, JSON, INI or other structured file key by key Write your own file format
have my settings saved without the player turning it on Set what is saved by default
keep window positions, paths or caches out of profiles Set what is saved by default
rename a key or change a value in a new version of my mod Convert settings between mod versions
store a setting differently on older Minecraft versions Convert settings between Minecraft versions
handle settings that depend on each other Merge dependent settings
read my config at the right moment on each loader Read your config after the restore
ship one mod for Fabric, Forge and NeoForge, old and new Build one integration for every loader
register without a service file Register from your own code
test formats and fixes in JUnit Test your integration without Minecraft
find out why nothing is synced Fix an integration that doesn't sync
look up a class or method The API at a glance

All pages#

Getting started

Guides (how to do one task)

Concepts (how it works)

Examples (complete, copyable)

Players and server admins#

The wiki explains how to install and use Settings Saver. Saving other mods' settings is the page to point your players to.

Start here

  1. Installation
  2. Your first integration
  3. Register files and directories
  4. Choose a file format
  5. Write your own file format
  6. Set what is saved by default
  7. Convert settings between mod versions
  8. Convert settings between Minecraft versions
  9. Merge dependent settings
  10. Read your config after the restore
  11. Build one integration for every loader
  12. Register from your own code
  13. Test your integration without Minecraft
  14. Fix an integration that doesn't sync

API reference

Browse the Javadoc

Packages