Wire up Language config

This commit is contained in:
nossr50 2019-03-19 03:12:36 -07:00
parent b9a37614b2
commit e933efcee0
3 changed files with 18 additions and 6 deletions

View File

@ -629,10 +629,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(ITEMS, CHIMAERA_WING, SOUND + "_" + ENABLED); return getBooleanValue(ITEMS, CHIMAERA_WING, SOUND + "_" + ENABLED);
} }
public boolean getFluxPickaxeSoundEnabled() {
return getBooleanValue(ITEMS, FLUX + PICKAXE, SOUND + "_" + ENABLED);
}
/* Particles */ /* Particles */
public boolean getAbilityActivationEffectEnabled() { public boolean getAbilityActivationEffectEnabled() {
return getBooleanValue(PARTICLES, ABILITY_ACTIVATION); return getBooleanValue(PARTICLES, ABILITY_ACTIVATION);

View File

@ -1,7 +1,24 @@
package com.gmail.nossr50.config.hocon.language; package com.gmail.nossr50.config.hocon.language;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigLanguage { 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;
}
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.locale; package com.gmail.nossr50.locale;
import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -76,7 +75,7 @@ public final class LocaleLoader {
if (bundle == null) { if (bundle == null) {
Locale.setDefault(new Locale("en", "US")); Locale.setDefault(new Locale("en", "US"));
Locale locale = null; Locale locale = null;
String[] myLocale = MainConfig.getInstance().getLocale().split("[-_ ]"); String[] myLocale = mcMMO.getConfigManager().getConfigLanguage().getTargetLanguage().split("[-_ ]");
if (myLocale.length == 1) { if (myLocale.length == 1) {
locale = new Locale(myLocale[0]); locale = new Locale(myLocale[0]);