Class ConfigMigration

java.lang.Object
privbot.config.ConfigMigration

public final class ConfigMigration extends Object
One-time, versioned changes to a plugin's saved settings, for a default that changed after users saved the old one.

Why: every plugin load writes every config value to the shared properties file, and RuneLite's default pass only replaces a stored value that no longer parses. A changed default therefore never reaches an existing install: a boss plugin's third fight (2026-09-26) ran with glyphs OFF, hazards LEARN and the old prayer restores because those old defaults still parsed, while the renamed prayer mode was reset (its old value no longer did).

A migration is a list of ConfigMigration.Steps, each with a version. run(privbot.config.ConfigMigration.ConfigAccess, privbot.config.ConfigMigration.Step...) applies every step whose version is above the stored settingsVersion of the group, in version order, then stores the highest version, so it runs once per install. replaceIfEquals(int, java.lang.String, java.lang.String, java.lang.String) only rewrites a value still equal to the old default (a value the user changed is left alone) and unset(int, java.lang.String) drops a dead key. Nothing here throws: an unreadable config is logged and nothing is changed (the version is not stored, so the next start tries again; every step is idempotent).

The version and the old values are read from the settings file on disk (ConfigMigration.ConfigAccess.saved(java.lang.String)), not from the client's memory. Every client on the machine shares that file, but each keeps the copy it loaded at launch and patches only the keys it writes. A client launched before another one migrated would otherwise see no version, migrate again from its stale copy and write the old defaults' replacements over a value the user has since chosen in the other client (review 2026-09-26, "a stale client overrides the user"). Reading the file, it sees the migration done and instead brings its own copy of every key the steps name in line with the file.