Fix TLocale

This commit is contained in:
坏黑 2019-07-14 00:20:22 +08:00
parent 651291b187
commit 2e47b3c72e

View File

@ -24,11 +24,14 @@ public class TLocaleLoader {
private static final Map<String, TLocaleInstance> map = new ConcurrentHashMap<>(); private static final Map<String, TLocaleInstance> map = new ConcurrentHashMap<>();
/**
* 因插件版载入慢于非插件版所以语言文件类型会被插件版本覆盖
* 解决方案主动兼容插件版本
*/
static { static {
// 插件版载入 > 非插件版导致非插件版语言文件类型被覆盖
// 解决方案识别插件版语言文件类型转换为非插件版
// 发现于 2019年7月13日
// 非插件版载入 > 插件版导致插件版语言文件类型被覆盖
// 解决方案检测插件版是否已经被加载
// 发现于 2019年7月14日
if (!TabooLibAPI.isOriginLoaded()) {
ConfigurationSerialization.registerClass(TLocaleText.class, "TEXT"); ConfigurationSerialization.registerClass(TLocaleText.class, "TEXT");
ConfigurationSerialization.registerClass(TLocaleJson.class, "JSON"); ConfigurationSerialization.registerClass(TLocaleJson.class, "JSON");
ConfigurationSerialization.registerClass(TLocaleBook.class, "BOOK"); ConfigurationSerialization.registerClass(TLocaleBook.class, "BOOK");
@ -37,6 +40,7 @@ public class TLocaleLoader {
ConfigurationSerialization.registerClass(TLocaleBossBar.class, "BAR"); ConfigurationSerialization.registerClass(TLocaleBossBar.class, "BAR");
ConfigurationSerialization.registerClass(TLocaleActionBar.class, "ACTION"); ConfigurationSerialization.registerClass(TLocaleActionBar.class, "ACTION");
} }
}
public static void sendTo(Plugin plugin, String path, CommandSender sender, String... args) { public static void sendTo(Plugin plugin, String path, CommandSender sender, String... args) {
TabooLibAPI.debug(plugin, "TLocaleLoader.sendTo: " + plugin + ", path: " + path + ", sender: " + sender + ", args: " + Arrays.asList(args)); TabooLibAPI.debug(plugin, "TLocaleLoader.sendTo: " + plugin + ", path: " + path + ", sender: " + sender + ", args: " + Arrays.asList(args));