Class YamlMigrator

java.lang.Object
com.enhancedechest.config.YamlMigrator

public final class YamlMigrator extends Object
Generic YAML migrator that runs on startup for every config/language file.

Three things it does (in order):

  1. Apply key renames — transfers the user's old value to the new key name.
  2. Add missing keys — fills in any key absent from the user's file with the bundled default.
  3. Write to disk — only when at least one change was made.

User values for existing, unchanged keys are NEVER touched.

  • Method Details

    • migrate

      public static boolean migrate(File file, InputStream defaultStream, List<YamlMigrator.Rename> renames, org.slf4j.Logger log)
      Migrates file against defaultStream.
      Parameters:
      file - the on-disk YAML file to upgrade
      defaultStream - the bundled resource stream with canonical default keys/values
      renames - ordered list of key renames (applied before filling missing keys)
      log - logger for summary output
      Returns:
      true if the file was modified and saved