Config file only finds on 2nd try

Hey,

While debugging 1 of my projects using the if statement below, it fails the first time, but can find my UUID the 2nd time. I can confirm that my file remains unchanged both times. What could be the cause of this?

Code:

if (PlayerDataManager.getInstance().getConfig().getChildrenMap().keySet().contains(player.getUniqueId()))
	System.out.println("I found " + player.getName());
else
	System.out.println("I couldn't find " + player.getName());

The file:

d1ce52a9-9ae2-4f85-82b6-3514db03f17e {
    level=1
    xp=0
}

I figured it only works after I save the UUID with data in the same session. How do I fix this?

Kind regards,
Thana

It seems like it is not loading the original data when being loaded in.

Whats your code to read the config in the first place?

I use

.getConfig().getNode()

If that’s what you’re asking.

No i mean whats the code for

getConfig()

As this is not bukkit, there is no default method called getConfig it means that you must have written getConfig yourself

I use PlayerDataManager.getInstance().getConfig() which refers to the private CommentedConfigurationNode.

I somehow fixed it 5 minutes ago however. Turns out the UUID would be saved as a String for the first time, but for some reason change into an actual UUID the 2nd time. I don’t know why it’d do that as I never set it in the config as a String, but I did some checks to see whether or not I’m dealing with the String-based UUID or UUID itself.

Thanks a lot anyways