From e933efcee0d6c129402be6e27f43b666d0a37db4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 19 Mar 2019 03:12:36 -0700 Subject: [PATCH] Wire up Language config --- .../com/gmail/nossr50/config/MainConfig.java | 4 ---- .../config/hocon/language/ConfigLanguage.java | 17 +++++++++++++++++ .../com/gmail/nossr50/locale/LocaleLoader.java | 3 +-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index ca082feac..7bbf555d0 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -629,10 +629,6 @@ public class MainConfig extends ConfigValidated { return getBooleanValue(ITEMS, CHIMAERA_WING, SOUND + "_" + ENABLED); } - public boolean getFluxPickaxeSoundEnabled() { - return getBooleanValue(ITEMS, FLUX + PICKAXE, SOUND + "_" + ENABLED); - } - /* Particles */ public boolean getAbilityActivationEffectEnabled() { return getBooleanValue(PARTICLES, ABILITY_ACTIVATION); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/language/ConfigLanguage.java b/src/main/java/com/gmail/nossr50/config/hocon/language/ConfigLanguage.java index a307d1667..2359d5cf5 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/language/ConfigLanguage.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/language/ConfigLanguage.java @@ -1,7 +1,24 @@ package com.gmail.nossr50.config.hocon.language; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigLanguage { + + public static final String TARGET_LANGUAGE_DEFAULT = "en_US"; + public static final String AVAILABLE_LANGUAGE_LIST = "cs_CZ, cy, da, de, en_US, es, fi, fr, hu_HU, it, ja_JP, ko," + + "\n nl, pl, pt_BR, ru, sv, th_TH, zh_CN, zh_TW"; + + @Setting(value = "Language", comment = "Which language mcMMO will use." + + "\nThe default language for mcMMO will be used for languages that do not have complete translations." + + "\nIf you'd wish to contribute to available languages please submit a pull request on our github" + + "\nhttps://github.com/mcMMO-Dev/mcMMO" + + "\nAvailable Languages: " + AVAILABLE_LANGUAGE_LIST + + "\n\nDefault value: "+TARGET_LANGUAGE_DEFAULT) + private String targetLanguage = TARGET_LANGUAGE_DEFAULT; + + public String getTargetLanguage() { + return targetLanguage; + } } diff --git a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java index 9836c0946..88d7c08d1 100644 --- a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java +++ b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.locale; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.mcMMO; import org.bukkit.ChatColor; @@ -76,7 +75,7 @@ public final class LocaleLoader { if (bundle == null) { Locale.setDefault(new Locale("en", "US")); Locale locale = null; - String[] myLocale = MainConfig.getInstance().getLocale().split("[-_ ]"); + String[] myLocale = mcMMO.getConfigManager().getConfigLanguage().getTargetLanguage().split("[-_ ]"); if (myLocale.length == 1) { locale = new Locale(myLocale[0]);