Add isTrueForAnyConfig, e.g. to check if to register listeners at all.

This commit is contained in:
asofold 2014-07-26 22:28:53 +02:00
parent 126c400813
commit 0496f281b7

View File

@ -281,6 +281,20 @@ public class ConfigManager {
ConfigManager.worldsMap = newWorldsMap;
}
/**
* Check if any config has a boolean set to true for the given path.
* @param path
* @return True if any config has a boolean set to true for the given path.
*/
public static boolean isTrueForAnyConfig(String path) {
for (final ConfigFile cfg : worldsMap.values()){
if (cfg.getBoolean(path, false)) {
return true;
}
}
return false;
}
/**
* Get the maximally found number for the given config path. This does not throw errors. It will return null, if nothing is found or all lookups failed otherwise.
* <br>