OneConfig V1
  • Welcome
  • Documentation license
  • Introduction
    • Getting started
  • Configuration
    • Creating your config
      • Option dependencies & hiding options
      • Listening for option changes
    • Available options
      • Boolean options
        • Switch option
        • Checkbox option
      • Number options
        • Slider option
        • Number option
      • Selector options
        • Dropdown option
        • Radio button option
      • Text option
      • Color option
      • Keybind option
      • Buttons
      • Accordions
      • Decorations
    • Creating your own options
  • Commands
    • Annotation-based commands
    • Tree-based commands
  • Events
    • Using the events system
      • Callback events
      • Subscriber events
  • Utilities Module
    • Hypixel utilities
    • IO utilities
    • Networking utilities
    • JSON utilities
    • Multithreading
    • Platform-specific utilities
  • Migration
    • Temporary V0 -> V1 migration guide
    • Migrating your configs from Vigilance
Powered by GitBook
On this page
  • Updating from V0
  • Full example
Export as PDF
  1. Migration

Migrating your configs from Vigilance

Updating from V0

OneConfig V0 had a system in which you would add a new VigilanceMigrator(...) to your config's super constructor call in order to tell it where to find your old Vigilance config. Now, in OneConfig V1, we are prioritizing allowing developers to migrate from more other config systems independently.

You can now replace your VigilanceMigrator instantiation with a call to loadFrom in your constructor, passing the path to your old config to it.

You can also replace all @VigilanceName annotations with the new @PreviousNames annotation, in which you can simply pass the full path (category + subcategory + name) to your old option, f.ex: "oldCategory.oldSubcategory.oldName1", "oldCategory.oldName2", ...

Full example

public class MyConfig extends Config {

    @Switch(
        title = "My Switch",
        description = "This is my switch",
        icon = "/my_switch.svg",
        category = "Switches",
        subcategory = "General"
    )
    @PreviousNames({"switches.general.mySwitch"})
    public static boolean mySwitch = false;
    
    public MyConfig() {
        super(
              "example_config.json",
              "/assets/examplemod/example_mod.png",
              "Example Mod",
              Category.QOL
         );
    
        loadFrom("config/my_mod.toml"); // Old Vigilance config
    }

}
object MyConfig : KtConfig(
     id = "example_config.json",
     icon = "/assets/examplemod/example_mod.png",
     title = "Example Mod",
     category = Config.Category.QOL
) {

    // TODO: Add @PreviousNames annotation for the Kotlin DSL
    var mySwitch: Boolean by switch(
        name = "My Switch",
        def = false, // Sets option's default value. Recommended, default = true
        description = "This is my switch", // Recommended, default = ""
        icon = "/my_switch.svg", // Optional, default = ""
        category = "Switches", // Recommended, default = "General"
        subcategory = "General" // Recommended, default = "General"
    )
    
    init {
        loadFrom("config/my_mod.toml") // Old Vigilance config
    }

}
PreviousTemporary V0 -> V1 migration guide

Last updated 5 months ago