Hi, I am using 1.8.8 spigot api and trying to use contains method to check if config already has that path. Code (Text): String a = String.valueOf(data.getCustomConfig().contains("killstreaks.GoksiMaca" )); Bukkit.broadcastMessage(a); But this always return false even if my config contains that path I also tried isSet() but it also returns false. my config: Code (Text): killstreaks: GoksiMaca: 0 GoksiTest: 3
Code I typed here was actually just for debugging, Im using it to check if my data file (custom yaml config) already have set value of specific player.
Well, another way you could check with a method would be like: Code (Text): public boolean configPathExists(String path) { return data.getCustomConfig().getString(path) != null; }
Add your own. This is what I did: Code (Text): private boolean contains(String path, boolean ignoreDefault) { // This duplicates the method added in 1.9, Bukkit commit facc9c353c3 return ((ignoreDefault) ? plugin.getConfig().get(path, null) : plugin.getConfig().get(path)) != null; } You may have to change the plugin.getConfig() parts.