Update CraftBukkit to use new YamlConfiguration encoding changes

This commit is contained in:
Wesley Wolfe 2014-05-14 05:49:04 -05:00
parent 8daacb9017
commit fa1b6ba834
2 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -76,8 +77,6 @@ import net.minecraft.server.EntityTracker;
import net.minecraft.server.EnumDifficulty;
import net.minecraft.server.EnumGamemode;
import net.minecraft.server.ExceptionWorldConflict;
import net.minecraft.server.GameProfileBanEntry;
import net.minecraft.server.GameProfileBanList;
import net.minecraft.server.Items;
import net.minecraft.server.JsonListEntry;
import net.minecraft.server.PlayerList;
@ -144,7 +143,6 @@ import org.bukkit.craftbukkit.updater.BukkitDLUpdaterService;
import org.bukkit.craftbukkit.util.CraftIconCache;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.DatFileFilter;
import org.bukkit.craftbukkit.util.MojangNameLookup;
import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
@ -263,7 +261,7 @@ public final class CraftServer implements Server {
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
configuration.options().copyDefaults(true);
configuration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml")));
configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), Charsets.UTF_8)));
ConfigurationSection legacyAlias = null;
if (!configuration.isString("aliases")) {
legacyAlias = configuration.getConfigurationSection("aliases");
@ -275,7 +273,7 @@ public final class CraftServer implements Server {
}
commandsConfiguration = YamlConfiguration.loadConfiguration(getCommandsConfigFile());
commandsConfiguration.options().copyDefaults(true);
commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml")));
commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)));
saveCommandsConfig();
// Migrate aliases from old file and add previously implicit $1- to pass all arguments

View file

@ -6,8 +6,11 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.help.HelpTopic;
import com.google.common.base.Charsets;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
@ -25,7 +28,7 @@ public class HelpYamlReader {
this.server = server;
File helpYamlFile = new File("help.yml");
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/help.yml"));
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/help.yml"), Charsets.UTF_8));
try {
helpYaml = YamlConfiguration.loadConfiguration(helpYamlFile);