Use Reader-based load() method on YamlConfiguration instead of the deprecated InputStream-based method. Fixes #374

This is necessary because the InputStream-based method is removed in 1.12.
This commit is contained in:
Andreas Troelsen 2017-05-20 21:33:04 +02:00
parent 1da7b564d1
commit 574a4fdb5f

View File

@ -9,6 +9,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
@ -36,7 +37,7 @@ public class ConfigUtils
private static void process(Plugin plugin, String resource, ConfigurationSection section, boolean addOnlyIfEmpty, boolean removeObsolete) {
try {
YamlConfiguration defaults = new YamlConfiguration();
defaults.load(plugin.getResource("res/" + resource));
defaults.load(new InputStreamReader(plugin.getResource("res/" + resource)));
process(defaults, section, addOnlyIfEmpty, removeObsolete);
plugin.saveConfig();