Removed the cache from BSBLocale

because YAMLConfiguration is a cache itself.
This commit is contained in:
Florian CUNY 2018-01-03 21:57:32 +01:00
parent 62480d7249
commit afa292986d

View File

@ -15,12 +15,10 @@ public class BSBLocale {
private Locale locale;
private YamlConfiguration config;
private Map<String, String> cache;
public BSBLocale(Locale locale, File file) {
this.locale = locale;
this.config = YamlConfiguration.loadConfiguration(file);
this.cache = new HashMap<>();
}
/**
@ -29,19 +27,12 @@ public class BSBLocale {
* @return Text for this locale reference or the reference if nothing has been found
*/
public String get(String reference) {
if (cache.containsKey(reference)) {
return cache.get(reference);
} else if (config.contains(reference)) {
cache.put(reference, ChatColor.translateAlternateColorCodes('&', config.getString(reference)));
return cache.get(reference);
if (config.contains(reference)) {
return config.getString(reference);
}
return reference; // return reference in case nothing has been found
}
public void clearCache() {
this.cache.clear();
}
/**
* Returns the locale language
* @return the locale language