mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-02-18 21:41:28 +01:00
Fix various translation issues
This commit is contained in:
parent
2c7ff2120c
commit
d7fa9e08f3
@ -48,6 +48,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -128,7 +129,7 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
|
|||||||
// deny the connection
|
// deny the connection
|
||||||
this.deniedAsyncLogin.add(e.getUniqueId());
|
this.deniedAsyncLogin.add(e.getUniqueId());
|
||||||
|
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
|
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), Locale.getDefault());
|
||||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
||||||
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(e.getUniqueId(), e.getName(), null);
|
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(e.getUniqueId(), e.getName(), null);
|
||||||
}
|
}
|
||||||
@ -177,7 +178,7 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
|
|||||||
if (this.detectedCraftBukkitOfflineMode) {
|
if (this.detectedCraftBukkitOfflineMode) {
|
||||||
printCraftBukkitOfflineModeError();
|
printCraftBukkitOfflineModeError();
|
||||||
|
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR_CB_OFFLINE_MODE.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
|
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR_CB_OFFLINE_MODE.build(), TranslationManager.parseLocale(player.getLocale(), Locale.getDefault()));
|
||||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -188,7 +189,7 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
|
|||||||
" - denying login.");
|
" - denying login.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
|
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), Locale.getDefault()));
|
||||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -207,7 +208,7 @@ public class BukkitConnectionListener extends AbstractConnectionListener impleme
|
|||||||
player.getUniqueId() + " - " + player.getName() + " - denying login.");
|
player.getUniqueId() + " - " + player.getName() + " - denying login.");
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_SETUP_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), TranslationManager.DEFAULT_LOCALE));
|
Component reason = GlobalTranslator.render(Message.LOADING_SETUP_ERROR.build(), TranslationManager.parseLocale(player.getLocale(), Locale.getDefault()));
|
||||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, LegacyComponentSerializer.legacySection().serialize(reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.bungee.listeners;
|
|||||||
import me.lucko.luckperms.bungee.LPBungeePlugin;
|
import me.lucko.luckperms.bungee.LPBungeePlugin;
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.Message;
|
import me.lucko.luckperms.common.locale.Message;
|
||||||
import me.lucko.luckperms.common.locale.TranslationManager;
|
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||||
|
|
||||||
@ -44,6 +43,7 @@ import net.md_5.bungee.api.plugin.Listener;
|
|||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.md_5.bungee.event.EventPriority;
|
import net.md_5.bungee.event.EventPriority;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class BungeeConnectionListener extends AbstractConnectionListener implements Listener {
|
public class BungeeConnectionListener extends AbstractConnectionListener implements Listener {
|
||||||
@ -100,7 +100,7 @@ public class BungeeConnectionListener extends AbstractConnectionListener impleme
|
|||||||
// there was some error loading
|
// there was some error loading
|
||||||
if (this.plugin.getConfiguration().get(ConfigKeys.CANCEL_FAILED_LOGINS)) {
|
if (this.plugin.getConfiguration().get(ConfigKeys.CANCEL_FAILED_LOGINS)) {
|
||||||
// cancel the login attempt
|
// cancel the login attempt
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
|
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), Locale.getDefault());
|
||||||
e.setCancelReason(BungeeComponentSerializer.get().serialize(reason));
|
e.setCancelReason(BungeeComponentSerializer.get().serialize(reason));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -70,29 +70,29 @@ public enum Dependency {
|
|||||||
ADVENTURE_PLATFORM(
|
ADVENTURE_PLATFORM(
|
||||||
"me{}lucko",
|
"me{}lucko",
|
||||||
"adventure-platform-api",
|
"adventure-platform-api",
|
||||||
"4.0.0",
|
"4.0.1",
|
||||||
"SgUP+9qpF0QogfbR7NOmXJ9zoi3gyMAAh4igc4SivO4=",
|
"ie3rz49jg5HU04mWe/f6lXjHt6L+S2SQp/x6YFbhxsc=",
|
||||||
Relocation.of("adventure", "net{}kyori{}adventure")
|
Relocation.of("adventure", "net{}kyori{}adventure")
|
||||||
),
|
),
|
||||||
ADVENTURE_PLATFORM_BUKKIT(
|
ADVENTURE_PLATFORM_BUKKIT(
|
||||||
"me{}lucko",
|
"me{}lucko",
|
||||||
"adventure-platform-bukkit",
|
"adventure-platform-bukkit",
|
||||||
"4.0.0",
|
"4.0.1",
|
||||||
"St2dvhkBLX4Wr+yZeRbICh/hlw0uhA6cfN/0Ua6YGw4=",
|
"dVbYfUJqmde8jeuTvknCL9hbzqxybal00TELTzQgLbk=",
|
||||||
Relocation.of("adventure", "net{}kyori{}adventure")
|
Relocation.of("adventure", "net{}kyori{}adventure")
|
||||||
),
|
),
|
||||||
ADVENTURE_PLATFORM_BUNGEECORD(
|
ADVENTURE_PLATFORM_BUNGEECORD(
|
||||||
"me{}lucko",
|
"me{}lucko",
|
||||||
"adventure-platform-bungeecord",
|
"adventure-platform-bungeecord",
|
||||||
"4.0.0",
|
"4.0.1",
|
||||||
"CNvYc3//7OqEz2615Omuq0rRpORvDiy1kEJuzi0lc4Q=",
|
"4phi0TxNKVj5Lko63nlkrd5snIJcaU+cXUfAWsbCX1U=",
|
||||||
Relocation.of("adventure", "net{}kyori{}adventure")
|
Relocation.of("adventure", "net{}kyori{}adventure")
|
||||||
),
|
),
|
||||||
ADVENTURE_PLATFORM_SPONGEAPI(
|
ADVENTURE_PLATFORM_SPONGEAPI(
|
||||||
"me{}lucko",
|
"me{}lucko",
|
||||||
"adventure-platform-spongeapi",
|
"adventure-platform-spongeapi",
|
||||||
"4.0.0",
|
"4.0.1",
|
||||||
"qVFz5oHdpiHI+KLMKSigpmu+T5nYZ25BmGYC6Imcx9A=",
|
"6fjWuZMeJ6633RKuZh6sIlMyVIzryQoewONeei2nB+4=",
|
||||||
Relocation.of("adventure", "net{}kyori{}adventure")
|
Relocation.of("adventure", "net{}kyori{}adventure")
|
||||||
),
|
),
|
||||||
EVENT(
|
EVENT(
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.locale;
|
package me.lucko.luckperms.common.locale;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
@ -33,12 +35,17 @@ import net.kyori.adventure.translation.TranslationRegistry;
|
|||||||
import net.kyori.adventure.translation.Translator;
|
import net.kyori.adventure.translation.Translator;
|
||||||
import net.kyori.adventure.util.UTF8ResourceBundleControl;
|
import net.kyori.adventure.util.UTF8ResourceBundleControl;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.PropertyResourceBundle;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -105,28 +112,51 @@ public class TranslationManager {
|
|||||||
translationFiles = Collections.emptyList();
|
translationFiles = Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<Locale, ResourceBundle> loaded = new HashMap<>();
|
||||||
for (Path translationFile : translationFiles) {
|
for (Path translationFile : translationFiles) {
|
||||||
try {
|
try {
|
||||||
loadCustomTranslationFile(translationFile);
|
Map.Entry<Locale, ResourceBundle> result = loadCustomTranslationFile(translationFile);
|
||||||
|
if (result != null) {
|
||||||
|
loaded.put(result.getKey(), result.getValue());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
this.plugin.getLogger().warn("Error loading locale file: " + translationFile.getFileName().toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try registering the locale without a country code - if we don't already have a registration for that
|
||||||
|
loaded.forEach((locale, bundle) -> {
|
||||||
|
Locale localeWithoutCountry = new Locale(locale.getLanguage());
|
||||||
|
if (!locale.equals(localeWithoutCountry) && this.installed.add(localeWithoutCountry)) {
|
||||||
|
this.registry.registerAll(localeWithoutCountry, bundle, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCustomTranslationFile(Path translationFile) {
|
private Map.Entry<Locale, ResourceBundle> loadCustomTranslationFile(Path translationFile) {
|
||||||
String fileName = translationFile.getFileName().toString();
|
String fileName = translationFile.getFileName().toString();
|
||||||
String localeString = fileName.substring(0, fileName.length() - ".properties".length());
|
String localeString = fileName.substring(0, fileName.length() - ".properties".length());
|
||||||
Locale locale = parseLocale(localeString, null);
|
Locale locale = parseLocale(localeString, null);
|
||||||
|
|
||||||
if (locale == null) {
|
if (locale == null) {
|
||||||
this.plugin.getLogger().warn("Unknown locale '" + localeString + "' - unable to register.");
|
this.plugin.getLogger().warn("Unknown locale '" + localeString + "' - unable to register.");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.registry.registerAll(locale, translationFile, true);
|
PropertyResourceBundle bundle;
|
||||||
|
try (BufferedReader reader = Files.newBufferedReader(translationFile, StandardCharsets.UTF_8)) {
|
||||||
|
bundle = new PropertyResourceBundle(reader);
|
||||||
|
} catch(IOException e) {
|
||||||
|
this.plugin.getLogger().warn("Error loading locale file: " + localeString);
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.registry.registerAll(locale, bundle, false);
|
||||||
this.plugin.getLogger().info("Registered additional translations for " + locale.toString());
|
this.plugin.getLogger().info("Registered additional translations for " + locale.toString());
|
||||||
this.installed.add(locale);
|
this.installed.add(locale);
|
||||||
|
return Maps.immutableEntry(locale, bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Locale parseLocale(String locale, Locale defaultLocale) {
|
public static Locale parseLocale(String locale, Locale defaultLocale) {
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.nukkit;
|
package me.lucko.luckperms.nukkit;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.locale.TranslationManager;
|
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.sender.SenderFactory;
|
import me.lucko.luckperms.common.sender.SenderFactory;
|
||||||
|
|
||||||
@ -64,9 +63,11 @@ public class NukkitSenderFactory extends SenderFactory<LPNukkitPlugin, CommandSe
|
|||||||
@Override
|
@Override
|
||||||
protected void sendMessage(CommandSender sender, Component message) {
|
protected void sendMessage(CommandSender sender, Component message) {
|
||||||
// Fallback to legacy format
|
// Fallback to legacy format
|
||||||
Locale locale = TranslationManager.DEFAULT_LOCALE;
|
Locale locale;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
locale = ((Player) sender).getLocale();
|
locale = ((Player) sender).getLocale();
|
||||||
|
} else {
|
||||||
|
locale = Locale.getDefault();
|
||||||
}
|
}
|
||||||
Component rendered = GlobalTranslator.render(message, locale);
|
Component rendered = GlobalTranslator.render(message, locale);
|
||||||
sender.sendMessage(LegacyComponentSerializer.legacySection().serialize(rendered));
|
sender.sendMessage(LegacyComponentSerializer.legacySection().serialize(rendered));
|
||||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.nukkit.listeners;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.Message;
|
import me.lucko.luckperms.common.locale.Message;
|
||||||
import me.lucko.luckperms.common.locale.TranslationManager;
|
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||||
import me.lucko.luckperms.nukkit.LPNukkitPlugin;
|
import me.lucko.luckperms.nukkit.LPNukkitPlugin;
|
||||||
@ -48,6 +47,7 @@ import cn.nukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class NukkitConnectionListener extends AbstractConnectionListener impleme
|
|||||||
// deny the connection
|
// deny the connection
|
||||||
this.deniedAsyncLogin.add(e.getUuid());
|
this.deniedAsyncLogin.add(e.getUuid());
|
||||||
|
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
|
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), Locale.getDefault());
|
||||||
e.disAllow(LegacyComponentSerializer.legacySection().serialize(reason));
|
e.disAllow(LegacyComponentSerializer.legacySection().serialize(reason));
|
||||||
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(e.getUuid(), e.getName(), null);
|
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(e.getUuid(), e.getName(), null);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.sponge.listeners;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.Message;
|
import me.lucko.luckperms.common.locale.Message;
|
||||||
import me.lucko.luckperms.common.locale.TranslationManager;
|
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||||
@ -45,6 +44,7 @@ import org.spongepowered.api.util.Tristate;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public class SpongeConnectionListener extends AbstractConnectionListener {
|
|||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.setMessageCancelled(false);
|
e.setMessageCancelled(false);
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
|
Component reason = GlobalTranslator.render(Message.LOADING_DATABASE_ERROR.build(), Locale.getDefault());
|
||||||
e.setMessage(SpongeComponentSerializer.get().serialize(reason));
|
e.setMessage(SpongeComponentSerializer.get().serialize(reason));
|
||||||
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(profile.getUniqueId(), username, null);
|
this.plugin.getEventDispatcher().dispatchPlayerLoginProcess(profile.getUniqueId(), username, null);
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ public class SpongeConnectionListener extends AbstractConnectionListener {
|
|||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.setMessageCancelled(false);
|
e.setMessageCancelled(false);
|
||||||
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR.build(), TranslationManager.DEFAULT_LOCALE);
|
Component reason = GlobalTranslator.render(Message.LOADING_STATE_ERROR.build(), Locale.getDefault());
|
||||||
e.setMessage(SpongeComponentSerializer.get().serialize(reason));
|
e.setMessage(SpongeComponentSerializer.get().serialize(reason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.velocity;
|
|||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.locale.TranslationManager;
|
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.sender.SenderFactory;
|
import me.lucko.luckperms.common.sender.SenderFactory;
|
||||||
import me.lucko.luckperms.velocity.service.CompatibilityUtil;
|
import me.lucko.luckperms.velocity.service.CompatibilityUtil;
|
||||||
@ -64,9 +63,11 @@ public class VelocitySenderFactory extends SenderFactory<LPVelocityPlugin, Comma
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendMessage(CommandSource source, Component message) {
|
protected void sendMessage(CommandSource source, Component message) {
|
||||||
Locale locale = TranslationManager.DEFAULT_LOCALE;
|
Locale locale;
|
||||||
if (source instanceof Player) {
|
if (source instanceof Player) {
|
||||||
locale = ((Player) source).getPlayerSettings().getLocale();
|
locale = ((Player) source).getPlayerSettings().getLocale();
|
||||||
|
} else {
|
||||||
|
locale = Locale.getDefault();
|
||||||
}
|
}
|
||||||
Component rendered = GlobalTranslator.render(message, locale);
|
Component rendered = GlobalTranslator.render(message, locale);
|
||||||
AdventureCompat.sendMessage(source, rendered);
|
AdventureCompat.sendMessage(source, rendered);
|
||||||
|
Loading…
Reference in New Issue
Block a user