Context: Code (Text): ConfigManager.get().set("location", blockLocation); ConfigManager.get().set("chestLocked", chestLocked); ConfigManager.save(); if(ConfigManager.get().getInt("location.x") == (blockX) && ConfigManager.get().getInt("location.y") == (blockY)){ System.out.println("Data exists"); }else{ System.out.println(ConfigManager.get().getInt("location.x")); System.out.println("Data does not exist"); System.out.println(blockX); System.out.println(blockY); } For some reason in the statement ConfigManager.get().getInt("location.x") is returning 0. However I can clearly check by printing out the values that it's 56. Here's what my config looks like: Code (Text): location: ==: org.bukkit.Location world: world x: 56.0 y: 63.0 z: 295.0 pitch: 0.0 yaw: 0.0 chestLocked: false
The path location.x does not exist so it returns the default value (0). You can just grab the location (Location location = config.getLocation("location"))
Location implements ConfigurationSerializable, which means that you can just use Code (Java): config.set("path.to.location", yourLocation); Code (Java): Location yourLocation = (Location) config.get("path.to.location");
It exists in the newest Spigot versions according to the Javadoc But like FrostedSnowman said, you can also cast it as it's still ConfigurationSerializable.