diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index 391a1f1..c9b3fa5 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -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); } } } diff --git a/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java b/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java index 6771183..28ee9a8 100644 --- a/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java +++ b/src/main/java/de/epiceric/shopchest/config/LanguageConfiguration.java @@ -16,9 +16,11 @@ public class LanguageConfiguration extends FileConfiguration { private HashMap 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; }