Hey guys so I’ve been fiddling around with HOCON configs for a while here and I’m a bit stumped as to what these two methods getChildrenList()
and getChildrenMap()
do exactly, and how to use them for my needs.
From my Understanding getChildrenList()
Returns a list of all the elements inside of a node if they’re separated by commas? Not sure if bracket or curly brace makes a difference.
getChildrenMap()
I am not sure what it does at all, I’ve seen a few different explanations but they don’t quite seem to agree. I assume it would grab all the nodes in nodeA{nodeB = "123" nodeC = "123"}
and puts them in a map using the node Key as the key and the value as the value, but I have attempted using it to no avail.
I was reading the source/documentation for configurate and it seems that if you have multiple of the same node, it will merge them?
This is the current project I’m working on using configs
you can take a look at the config, and I successfully load in the Strings from the commands and vote-sites nodes using getChildrenList()
Now my plugin is becoming a bit more complex so I have something like this currently
Rewards{
random:["12", "reward1", "say Reward1"]
random:["12", "reward2", "say Reward2"]
random:["15", "reward3", "say Reward3"]
random:["13", "reward4", "say Reward4"]
random:["78", "reward5", "say Reward5"]
set:["say This is a set Reward"]
set:["say this is another set Reward"]
}
From what I read, I thought if I used getChildrenList() on config.Rewards.random or config.Rewards.set it would load in all of them into the same internal “list”.
Any advice on how to use these two functions, or how I could approach my problem of correctly loading the above config information into an array would be appreciated. Or maybe you have suggestions as to how I could better design the config file.
Thanks in advance guys <3