Removed deprecated use of loadConfiguration

The new method properly uses the Reader class and resolves the reason
for deprecation, the lack of encoding support.
This commit is contained in:
Eric Stokes 2016-03-12 13:00:05 -07:00
parent bebd4742b9
commit 7b1e77340b

View File

@ -106,8 +106,7 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics; import org.mcstats.Metrics;
import java.io.File; import java.io.*;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -480,8 +479,19 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
public void loadConfigs() { public void loadConfigs() {
// Now grab the Configuration Files. // Now grab the Configuration Files.
this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml")); this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
Configuration coreDefaults = YamlConfiguration.loadConfiguration(this.getClass().getResourceAsStream("/defaults/config.yml")); InputStream resourceURL = this.getClass().getResourceAsStream("/defaults/config.yml");
// Read in our default config with UTF-8 now
Configuration coreDefaults;
try {
coreDefaults = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(resourceURL, "UTF-8")));
this.multiverseConfig.setDefaults(coreDefaults); this.multiverseConfig.setDefaults(coreDefaults);
} catch (UnsupportedEncodingException e) {
Logging.severe("Couldn't load default config with UTF-8 encoding. Details follow:");
e.printStackTrace();
Logging.severe("Default configs NOT loaded.");
}
this.multiverseConfig.options().copyDefaults(false); this.multiverseConfig.options().copyDefaults(false);
this.multiverseConfig.options().copyHeader(true); this.multiverseConfig.options().copyHeader(true);