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:
@@ -9,6 +9,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Locale;
|
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) {
|
private static void process(Plugin plugin, String resource, ConfigurationSection section, boolean addOnlyIfEmpty, boolean removeObsolete) {
|
||||||
try {
|
try {
|
||||||
YamlConfiguration defaults = new YamlConfiguration();
|
YamlConfiguration defaults = new YamlConfiguration();
|
||||||
defaults.load(plugin.getResource("res/" + resource));
|
defaults.load(new InputStreamReader(plugin.getResource("res/" + resource)));
|
||||||
|
|
||||||
process(defaults, section, addOnlyIfEmpty, removeObsolete);
|
process(defaults, section, addOnlyIfEmpty, removeObsolete);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
|
|||||||
Reference in New Issue
Block a user