From 94fa119813a96f13cd28b1e899ed8c9677dccbfa Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 13 May 2015 13:05:32 +1000 Subject: [PATCH] Fixes #307 --- PlotSquared/pom.xml | 2 +- .../translation/YamlTranslationFile.java | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 03072d753..24a2aab2e 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.10.8 + 2.10.9 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java b/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java index 1e60a63d4..d6ee8d1d2 100644 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java +++ b/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java @@ -9,13 +9,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.intellectualcrafters.plot.PlotSquared; -import com.intellectualcrafters.plot.config.C; - import org.bukkit.configuration.file.YamlConfiguration; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; +import com.intellectualcrafters.plot.config.C; + /** * The YAML implementation of TranslationFile Relies heavily on SnakeYAML * @@ -146,8 +145,11 @@ public class YamlTranslationFile extends TranslationFile { if (this.isC()) { YamlConfiguration conf = YamlConfiguration.loadConfiguration(this.file); for (String key : this.map.keySet()) { - C c = C.valueOf(key.toUpperCase()); - conf.set("locale." + c.getCat() + "." + key, this.map.get(key)); + try { + C c = C.valueOf(key.toUpperCase()); + conf.set("locale." + c.getCat() + "." + key, this.map.get(key)); + } + catch (IllegalArgumentException e) {} conf.set(key, null); } try { @@ -222,7 +224,7 @@ public class YamlTranslationFile extends TranslationFile { YamlConfiguration conf = YamlConfiguration.loadConfiguration(this.file); if (conf.get("locale") == null) { try { - this.map = (HashMap) getYaml().load(new FileReader(this.file)); + this.map = (HashMap) this.getYaml().load(new FileReader(this.file)); } catch (final Exception e) { e.printStackTrace(); } @@ -249,7 +251,7 @@ public class YamlTranslationFile extends TranslationFile { } } else { try { - this.map = (HashMap) getYaml().load(new FileReader(this.file)); + this.map = (HashMap) this.getYaml().load(new FileReader(this.file)); } catch (final Exception e) { e.printStackTrace(); } @@ -266,7 +268,7 @@ public class YamlTranslationFile extends TranslationFile { } public boolean isC() { - return isC; + return this.isC; } public void setIsC(boolean isC) {