mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-08 20:01:25 +01:00
Fixed console spam again
(Output of language reload)
This commit is contained in:
parent
3c822332d1
commit
0e73880603
@ -309,7 +309,7 @@ public class Config {
|
||||
}
|
||||
|
||||
private void loadLanguageConfig(boolean showMessages) {
|
||||
langConfig = new LanguageConfiguration(plugin);
|
||||
langConfig = new LanguageConfiguration(plugin, showMessages);
|
||||
File langFolder = new File(plugin.getDataFolder(), "lang");
|
||||
|
||||
if (!(new File(langFolder, "en_US.lang")).exists())
|
||||
@ -345,11 +345,13 @@ public class Config {
|
||||
}
|
||||
|
||||
langConfig.loadFromString(sb.toString());
|
||||
} catch (IOException | InvalidConfigurationException ex) {
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
if (showMessages) {
|
||||
plugin.getLogger().warning("Using default language values");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
plugin.debug("Using default language values (#1)");
|
||||
plugin.debug(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -358,19 +360,23 @@ public class Config {
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
if (showMessages) {
|
||||
plugin.getLogger().warning("Using default language values");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
plugin.debug("Using default language values (#2)");
|
||||
plugin.debug(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (showMessages) plugin.getLogger().info("Using locale \"" + langConfigFile.getName().substring(0, langConfigFile.getName().length() - 5) + "\"");
|
||||
langConfig.load(langConfigFile);
|
||||
} catch (IOException | InvalidConfigurationException ex) {
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
if (showMessages) {
|
||||
plugin.getLogger().warning("Using default language values");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
plugin.debug("Using default language values (#3)");
|
||||
plugin.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,11 @@ public class LanguageConfiguration extends FileConfiguration {
|
||||
private HashMap<String, String> values = new HashMap<>();
|
||||
|
||||
private ShopChest plugin;
|
||||
private boolean showMessages;
|
||||
|
||||
public LanguageConfiguration(ShopChest plugin) {
|
||||
public LanguageConfiguration(ShopChest plugin, boolean showMessages) {
|
||||
this.plugin = plugin;
|
||||
this.showMessages = showMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,7 +43,7 @@ public class LanguageConfiguration extends FileConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Could not find translation for \"" + path + "\" in selected language file. Using default translation (" + def + ")");
|
||||
if (showMessages) plugin.getLogger().info("Could not find translation for \"" + path + "\" in selected language file. Using default translation (" + def + ")");
|
||||
return def;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user