EssentialGG / Vigilance

Configuration Utility using Elementa
GNU Lesser General Public License v3.0
54 stars 12 forks source link

Using i18n names resets config values when using DSL #54

Closed Deftu closed 2 years ago

Deftu commented 2 years ago

I'm making a property using the property DSL with an i18n name, description:

        category("${Screencapper.ID}.config_category.upload") {
            selector(
                field = ::_uploadMode,
                name = "${Screencapper.ID}.config.upload.mode",
                description = "${Screencapper.ID}.config_description.upload.mode",
                options = UploadMode.values().map {
                    it.type
                },
                action = this@ScreencapperConfig::updateShareXButton
            )
        }

but after restarting the game and opening the config menu, the option's value is reset to the default value of _uploadMode.

I watched the config file during start-up and the value stayed as it should be when closing the game and the menu initially. It only resets when I open the menu.

I'm using Fabric 1.18.1 and Vigilance build 227.

Deftu commented 2 years ago

The issue was being caused by Kotlin init blocks not being called as I expected them to. I fixed the issue by calling Vigilant#initialize in my init function.