|
9 | 9 | import me.leoko.advancedban.manager.PunishmentManager;
|
10 | 10 | import me.leoko.advancedban.manager.UUIDManager;
|
11 | 11 | import me.leoko.advancedban.utils.Punishment;
|
| 12 | +import org.apache.commons.io.Charsets; |
12 | 13 | import org.bstats.bukkit.Metrics;
|
13 | 14 | import org.bukkit.Bukkit;
|
14 | 15 | import org.bukkit.OfflinePlayer;
|
|
21 | 22 | import org.json.simple.parser.JSONParser;
|
22 | 23 | import org.json.simple.parser.ParseException;
|
23 | 24 |
|
24 |
| -import java.io.File; |
25 |
| -import java.io.IOException; |
26 |
| -import java.io.InputStreamReader; |
| 25 | +import java.io.*; |
27 | 26 | import java.net.HttpURLConnection;
|
28 | 27 | import java.net.URL;
|
| 28 | +import java.nio.charset.StandardCharsets; |
29 | 29 | import java.util.List;
|
30 | 30 | import java.util.UUID;
|
31 | 31 |
|
@@ -54,16 +54,13 @@ public void loadFiles() {
|
54 | 54 | getPlugin().saveResource("Layouts.yml", true);
|
55 | 55 | }
|
56 | 56 |
|
57 |
| - config = YamlConfiguration.loadConfiguration(configFile); |
58 |
| - messages = YamlConfiguration.loadConfiguration(messageFile); |
59 |
| - layouts = YamlConfiguration.loadConfiguration(layoutFile); |
60 |
| - |
61 |
| - if (!config.contains("UUID-Fetcher")) { |
62 |
| - //noinspection ResultOfMethodCallIgnored |
63 |
| - configFile.renameTo(new File(getDataFolder(), "oldConfig.yml")); |
64 |
| - configFile = new File(getDataFolder(), "config.yml"); |
65 |
| - getPlugin().saveResource("config.yml", true); |
66 |
| - config = YamlConfiguration.loadConfiguration(configFile); |
| 57 | + try { |
| 58 | + config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)); |
| 59 | + messages = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(messageFile), StandardCharsets.UTF_8)); |
| 60 | + layouts = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(layoutFile), StandardCharsets.UTF_8)); |
| 61 | + } catch (FileNotFoundException exc) { |
| 62 | + // We just saved the files, so that should really not happen. |
| 63 | + Universal.get().debugException(exc); |
67 | 64 | }
|
68 | 65 | }
|
69 | 66 |
|
|
0 commit comments