Class CV6_ConfigRestructure

java.lang.Object
valorless.havenbags.configconversion.CV6_ConfigRestructure

public class CV6_ConfigRestructure extends Object
Performs in-place restructuring of the HavenBags configuration when an older config-version is detected. This converter currently upgrades configurations to version 6 by moving keys to new hierarchical paths and removing deprecated entries.

Safety: Before any change is applied, a backup of the original configuration file is created alongside the file using the pattern <name>.backup-<build><ext> so administrators can revert if needed.

Usage: This class is invoked internally during plugin startup and should not be called directly from user code.

  • Constructor Details

    • CV6_ConfigRestructure

      public CV6_ConfigRestructure()
  • Method Details

    • check

      @DoNotCall("Internal Use Only") public static void check(@NotNull valorless.valorlessutils.config.Config config)
      Checks the provided config and, if needed, performs a one-shot migration to config-version = 6. The migration:
      • Creates a backup copy of the existing config file.
      • Renames legacy flat keys to new nested keys (e.g., auto-save-interval to auto-save.interval).
      • Groups sound settings under sound.* and auto-pickup settings under auto-pickup.* with structured subkeys.
      • Removes deprecated keys after transferring their values.
      • Saves the updated configuration and logs progress.
      If the backup fails, the restructure is aborted to avoid destructive changes.
      Parameters:
      config - the configuration to migrate; must not be null