1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Fixed wrong file encodings

This commit is contained in:
TheBusyBiscuit 2020-01-30 23:48:40 +01:00
parent e05edcc7f0
commit 3bdaf04c88
4 changed files with 10 additions and 6 deletions

View File

@ -61,6 +61,7 @@
* Fixed #1313
* Fixed #1396
* Fixed Backpacks being placeable
* Fixed wrong file encoding for translations
## Release Candidate 4 (06 Jan 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4

View File

@ -244,7 +244,7 @@ public final class GuideSettings {
Language language = SlimefunPlugin.getLocal().getLanguage(p);
String languageName = language.isDefault() ? (SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")"): SlimefunPlugin.getLocal().getMessage(p, "languages." + language.getID());
menu.addItem(i, new CustomItem(language.getItem(), "&7Selected Language: &a" + languageName, "", "&b(experimental)", "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7messages, not items.", "", "&7\u21E8 &eClick to change your language"),
menu.addItem(i, new CustomItem(language.getItem(), "&7Selected Language: &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7messages, not items.", "", "&7\u21E8 &eClick to change your language"),
(pl, slot, item, action) -> {
openLanguages(pl);
return false;
@ -278,7 +278,7 @@ public final class GuideSettings {
}
Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage();
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &eClick to select the default language of the Server"),
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")),
(pl, i, item, action) -> {
PersistentDataAPI.remove(pl, SlimefunPlugin.getLocal().getKey());
@ -292,7 +292,7 @@ public final class GuideSettings {
int slot = 10;
for (Language language : SlimefunPlugin.getLocal().getLanguages()) {
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "", "&7\u21E8 &eClick to select this language"),
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select")),
(pl, i, item, action) -> {
PersistentDataAPI.setString(pl, SlimefunPlugin.getLocal().getKey(), language.getID());

View File

@ -3,13 +3,13 @@ package io.github.thebusybiscuit.slimefun4.core.services;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.logging.Level;
import io.github.thebusybiscuit.slimefun4.core.services.localization.SupportedLanguage;
import org.bukkit.NamespacedKey;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -18,6 +18,7 @@ import org.bukkit.entity.Player;
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization;
import io.github.thebusybiscuit.slimefun4.core.services.localization.SupportedLanguage;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -103,7 +104,7 @@ public class LocalizationService extends SlimefunLocalization {
// Loading in the defaults from our resources folder
String path = "/languages/messages_" + language + ".yml";
try (BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream(path)))) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream(path), StandardCharsets.UTF_8))) {
FileConfiguration config = YamlConfiguration.loadConfiguration(reader);
getConfig().getConfiguration().setDefaults(config);
} catch (IOException e) {
@ -118,7 +119,7 @@ public class LocalizationService extends SlimefunLocalization {
FileConfiguration cfg;
String path = "/languages/messages_" + id + ".yml";
try (BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream(path)))) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream(path), StandardCharsets.UTF_8))) {
cfg = YamlConfiguration.loadConfiguration(reader);
cfg.setDefaults(getConfig().getConfiguration());
} catch (IOException e) {

View File

@ -32,6 +32,8 @@ guide:
languages:
updated: '&aYour language was successfully set to: &b%lang%'
select: 'Click to select this language'
select-default: 'Click to select the default language'
translations:
name: '&aIs something missing?'