TheElectronWill / night-config

Powerful java configuration library for toml, yaml, hocon, json and in-memory configurations. Serialization/deserialization framework.
GNU Lesser General Public License v3.0
242 stars 28 forks source link

Why list is null #138

Closed mani1232 closed 1 year ago

mani1232 commented 1 year ago

image This null: https://github.com/mani1232/CustomBot/blob/dev-full-refactor/src/main/java/ua/mani123/config/Objects/BotConfig.java#L17 But creating with default is fine, and after convert back to object set list to null: https://github.com/mani1232/CustomBot/blob/dev-full-refactor/src/main/java/ua/mani123/config/ConfigUtils.java#L17

TheElectronWill commented 1 year ago

Well, I don't know exactly why because I cannot debug all the project, but I can try to give you some tips.

Have you checked the content of the file?

mani1232 commented 1 year ago

It generated by lib https://github.com/mani1232/CustomBot/blob/dev-full-refactor/src/main/java/ua/mani123/config/ConfigUtils.java#L23 But if im read this file by lib it return null, and how return empty list, not null

TheElectronWill commented 1 year ago

it is generated only if it doesn't exist, maybe an older version of the file is still there?

mani1232 commented 1 year ago

[[DiscordBot]]
    BotId = 0
    BotToken = "TOKEN_CHANGE_IT_1"

[[DiscordBot]]
    BotId = 1
    BotToken = "TOKEN_CHANGE_IT_2"

[[DiscordBot]]
    BotId = 2
    BotToken = "TOKEN_CHANGE_IT_3"

No, it latest

mani1232 commented 1 year ago

im fix it, im dont know why builder return null config, now im use parser

TheElectronWill commented 1 year ago

I think that the problem was: you forgot to call config.load()