Class CV7_ConfigRestructure

java.lang.Object
valorless.havenbags.configconversion.CV7_ConfigRestructure

public class CV7_ConfigRestructure extends Object
Migrates config.yml in-place to config-version = 7.

This converter is executed during plugin startup when an older config-version is detected. It performs a small restructure of a couple of legacy flat sections by converting them into structured sections. Currently affected settings:

  • hardcore-bags is converted into a section containing: enabled, unbound, bound, unused, and used.
  • protect-bags is converted into a section containing: enabled, unbound, bound, unused, and used.

Safety: Before any changes are written, a backup of the original configuration file is created next to the file using the pattern <name>.backup-<build><ext> (where build is taken from the plugin version string). If the backup fails, the migration is aborted to avoid destructive changes.

Note: Some setters are deferred by one tick using a Bukkit task to avoid potential timing issues with the underlying configuration IO. The migration still completes during startup.

  • Constructor Details

    • CV7_ConfigRestructure

      public CV7_ConfigRestructure()
  • Method Details

    • check

      @DoNotCall("Internal Use Only") public static void check(@NotNull valorless.valorlessutils.config.Config config)
      Checks the given configuration and performs a one-time migration to config-version = 7 when required.

      The migration will:

      1. Create/update a backup copy of the existing config file.
      2. Set config-version to 7.
      3. If hardcore-bags exists, remove the legacy value and create the new hardcore-bags.* keys with defaults.
      4. If protect-bags exists, remove the legacy value and create the new protect-bags.* keys with defaults.
      5. Save the updated configuration.

      This method is intended for internal use during startup only and should not be called directly.

      Parameters:
      config - configuration wrapper to migrate