Skip to content

Commit

Permalink
Add an option to skip loading a language
Browse files Browse the repository at this point in the history
  • Loading branch information
Krasjet committed Oct 1, 2016
1 parent 1f34cd7 commit c44af68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'maven-publish'

group = 'com.meowj'
archivesBaseName = 'LangUtils'
version = '1.6.1'
version = '1.6.2'

final def BUKKIT_VERSION = '1.10.2-R0.1-SNAPSHOT'

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/meowj/langutils/LangUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.util.ArrayList;
import java.util.logging.Level;

/**
Expand Down Expand Up @@ -47,6 +48,7 @@ public void onEnable() {
info("Language Utils has been enabled." + "(" + (System.currentTimeMillis() - startTime) + "ms)");

config.addDefault("FallbackLanguage", "en_US");
config.addDefault("SkipLanguage", new ArrayList<String>());
config.options().copyDefaults(true);
saveConfig();

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/meowj/langutils/lang/convert/EnumLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ public static EnumLang get(String locale) {
*/
public static void init() {
for (EnumLang enumLang : EnumLang.values()) {
if (LangUtils.plugin.config.getStringList("SkipLanguage").contains(enumLang.getLocale())) {
LangUtils.plugin.info("Skipped " + enumLang.getLocale());
continue;
}
try {
readFile(enumLang, new BufferedReader(new InputStreamReader(EnumLang.class.getResourceAsStream("/lang/" + enumLang.locale + ".lang"), Charset.forName("UTF-8"))));
LangUtils.plugin.info(enumLang.getLocale() + " has been loaded.");
Expand Down

0 comments on commit c44af68

Please sign in to comment.