getChildrenMap always returns nullPointerException

Hey. Iv’e been trying to get the children map of a node in my config, but trying to get it always returns null, even if children are present.

Method: http://pastebin.com/a0bbTfkD

Config file: http://pastebin.com/jWZshSkN

Now I would think the map would include both “1” and “-1”, as they are both children of Arenas, unless im understanding it completely wrong.

Thanks for your help!

getChildrenMap() never returns null, do you mean it returns an empty map?

I think your issue is that getConfig() is probably the root node, so you don’t need to specify PlayerArenas in the path.

Try

return getConfig().getNode("Arenas").getChildrenMap();

Sorry for my horrible phrasing. Ofcourse i meant an empty map resulting in a NullPointerException when trying to return it since the map is empty. All getConfig() does is returns a CommentedConfigurationNode config.

Here is my full ConfigManager incase it is of any help: http://pastebin.com/5r01JTmF
and the error I get: http://pastebin.com/EQ8PAe9n

setupArenaConfig(int name, UUID uuid) is what adds new nodes to the config. Am I adding them in a way that doesn’t allow childrenMaps?

I bet config and thus getConfig() is null. Did you run the setup method (and not get a stacktrace) before getArenaMap()?

hm ofcourse. I ran setup on GameStartingServerEvent and addArenas() on GamePostInitializationEvent.

Completely missed that! Moving addArenas() to GameStartedServerEvent fixed the issue.

Thank you guys for your help.