diff --git a/pom.xml b/pom.xml index 3408ef220..595469c99 100755 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ org.bukkit bukkit - 1.11.2-R0.1-SNAPSHOT + 1.12-pre2-SNAPSHOT provided diff --git a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java index d13bd7aaa..697930d23 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java @@ -25,7 +25,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader { @Override protected void loadFile() { super.loadFile(); - FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResource(fileName)); + FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResourceAsReader(fileName)); Set configKeys = config.getKeys(true); Set internalConfigKeys = internalConfig.getKeys(true); diff --git a/src/main/java/com/gmail/nossr50/config/HiddenConfig.java b/src/main/java/com/gmail/nossr50/config/HiddenConfig.java index 76eca334d..ac124ed18 100644 --- a/src/main/java/com/gmail/nossr50/config/HiddenConfig.java +++ b/src/main/java/com/gmail/nossr50/config/HiddenConfig.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.config; +import java.io.InputStreamReader; + import org.bukkit.configuration.file.YamlConfiguration; import com.gmail.nossr50.mcMMO; @@ -29,8 +31,9 @@ public class HiddenConfig { } public void load() { - if (mcMMO.p.getResource(fileName) != null) { - config = YamlConfiguration.loadConfiguration(mcMMO.p.getResource(fileName)); + InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName); + if (reader != null) { + config = YamlConfiguration.loadConfiguration(reader); chunkletsEnabled = config.getBoolean("Options.Chunklets", true); conversionRate = config.getInt("Options.ConversionRate", 1); useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true); diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 1dc5044be..63a3dffd1 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -2,6 +2,8 @@ package com.gmail.nossr50; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -64,6 +66,7 @@ import com.gmail.nossr50.util.experience.FormulaManager; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.upgrade.UpgradeManager; +import com.google.common.base.Charsets; import net.shatteredlands.shatt.backup.ZipLibrary; @@ -508,4 +511,9 @@ public class mcMMO extends JavaPlugin { getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml."); } } + + public InputStreamReader getResourceAsReader(String fileName) { + InputStream in = getResource(fileName); + return in == null ? null : new InputStreamReader(in, Charsets.UTF_8); + } } diff --git a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java index fbbd290b3..b3e0c232f 100644 --- a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java +++ b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java @@ -16,7 +16,7 @@ public class ChildConfig extends AutoUpdateConfigLoader { @Override protected void loadKeys() { - config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource("child.yml"))); + config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResourceAsReader("child.yml"))); FamilyTree.clearRegistrations(); // when reloading, need to clear statics