mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-03 22:37:44 +01:00
Optimize world config retrieval.
This commit is contained in:
parent
dc0aa6bf28
commit
a79cd3f6f2
@ -132,7 +132,14 @@ public class ConfigManager {
|
||||
public static ConfigFile getConfigFile(final String worldName) {
|
||||
final ConfigFile configFile = worldsMap.get(worldName);
|
||||
if (configFile != null) return configFile;
|
||||
return getConfigFile();
|
||||
// Expensive only once, for the rest of runtime the file is returned fast.
|
||||
synchronized(ConfigManager.class){
|
||||
// Need to check again.
|
||||
if (worldsMap.containsKey(worldName)) return worldsMap.get(worldName);
|
||||
final ConfigFile globalConfig = getConfigFile();
|
||||
worldsMap.put(worldName, globalConfig);
|
||||
return globalConfig;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user