From e864468539c4bbd8a61a42cb3dd69fd5118d8b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Sat, 6 Jul 2019 22:42:05 +0800 Subject: [PATCH] Fix --- .../com/ilummc/tlib/resources/TLocaleLoader.java | 9 ++------- src/main/scala/me/skymc/taboolib/Main.java | 15 +-------------- .../me/skymc/taboolib/socket/TabooLibClient.java | 7 ------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/main/scala/com/ilummc/tlib/resources/TLocaleLoader.java b/src/main/scala/com/ilummc/tlib/resources/TLocaleLoader.java index 98f9a99..749e222 100644 --- a/src/main/scala/com/ilummc/tlib/resources/TLocaleLoader.java +++ b/src/main/scala/com/ilummc/tlib/resources/TLocaleLoader.java @@ -6,7 +6,6 @@ import com.ilummc.tlib.logger.TLogger; import com.ilummc.tlib.resources.type.*; import com.ilummc.tlib.util.IO; import com.ilummc.tlib.util.Strings; -import me.skymc.taboocode.TabooCodeLang; import me.skymc.taboolib.Main; import me.skymc.taboolib.TabooLib; import me.skymc.taboolib.fileutils.ConfigUtils; @@ -82,24 +81,20 @@ public class TLocaleLoader { if (localeFile == null) { return; } - // 加载文件 - infoLogger("TRY-LOADING-LANG", plugin.getName(), localeFile.getName()); YamlConfiguration localeConfiguration = ConfigUtils.loadYaml(plugin, localeFile); YamlConfiguration localeConfigurationAtStream = getLocaleAtStream(plugin, localeFile); - // 载入配置 loadPluginLocale(plugin, localeFile, localeConfiguration, localeConfigurationAtStream); - // 注册监听 TLib.getTLib().getConfigWatcher().removeListener(localeFile); TLib.getTLib().getConfigWatcher().addListener(localeFile, null, obj -> { - infoLogger("RELOADING-LANG", plugin.getName()); loadPluginLocale(plugin, localeFile, ConfigUtils.loadYaml(plugin, localeFile), getLocaleAtStream(plugin, localeFile)); }); } } catch (Exception e) { - errorLogger("ERROR-LOADING-LANG", plugin.getName(), e.toString() + "\n" + e.getStackTrace()[0].toString()); + errorLogger("ERROR-LOADING-LANG", plugin.getName(), e.toString()); + e.printStackTrace(); } } diff --git a/src/main/scala/me/skymc/taboolib/Main.java b/src/main/scala/me/skymc/taboolib/Main.java index f4760f7..322d709 100644 --- a/src/main/scala/me/skymc/taboolib/Main.java +++ b/src/main/scala/me/skymc/taboolib/Main.java @@ -2,7 +2,6 @@ package me.skymc.taboolib; import com.ilummc.tlib.TLib; import com.ilummc.tlib.filter.TLoggerFilter; -import com.ilummc.tlib.resources.TLocale; import me.skymc.taboolib.database.GlobalDataManager; import me.skymc.taboolib.database.PlayerDataManager; import me.skymc.taboolib.economy.EcoUtils; @@ -92,16 +91,11 @@ public class Main extends JavaPlugin { if (getStorageType() == StorageType.SQL) { GlobalDataManager.SQLMethod.startSQLMethod(); } - // 载入完成 - TLocale.Logger.info("NOTIFY.SUCCESS-LOADED", getDescription().getAuthors().toString(), getDescription().getVersion(), String.valueOf(TabooLib.getVersion())); // 文件保存 Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> DataUtils.saveAllCaches(), 20, 20 * 120); Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> PlayerDataManager.saveAllCaches(true, false), 20, 20 * 60); // 文件监控 - TLib.getTLib().getConfigWatcher().addSimpleListener(new File(getDataFolder(), "config.yml"), () -> { - reloadConfig(); - TLocale.Logger.info("CONFIG.RELOAD-SUCCESS", inst.getName(), "config.yml"); - }); + TLib.getTLib().getConfigWatcher().addSimpleListener(new File(getDataFolder(), "config.yml"), this::reloadConfig); // 插件联动 new BukkitRunnable() { @@ -122,11 +116,6 @@ public class Main extends JavaPlugin { @Override public void onDisable() { disable = true; - // 如果插件尚未启动完成 - if (!started) { - TLocale.Logger.error("NOTIFY.FAIL-DISABLE"); - return; - } // 注销插件 TabooLibLoader.unregister(); // 保存数据 @@ -153,8 +142,6 @@ public class Main extends JavaPlugin { if (getStorageType() == StorageType.SQL && getConfig().getBoolean("DELETE-VARIABLE")) { GlobalDataManager.clearInvalidVariables(); } - // 提示信息 - TLocale.Logger.info("NOTIFY.SUCCESS-DISABLE"); // 卸载牛逼玩意儿 TLib.unload(); // 关闭服务器 diff --git a/src/main/scala/me/skymc/taboolib/socket/TabooLibClient.java b/src/main/scala/me/skymc/taboolib/socket/TabooLibClient.java index 9309e5d..8eb0a24 100644 --- a/src/main/scala/me/skymc/taboolib/socket/TabooLibClient.java +++ b/src/main/scala/me/skymc/taboolib/socket/TabooLibClient.java @@ -65,13 +65,6 @@ public class TabooLibClient { notify = false; TLocale.sendToConsole("COMMUNICATION.SUCCESS-CONNECTED"); } catch (SocketException e) { - /* - 防止未启用终端服务器导致重复提示连接失败信息 - */ - if (!notify && !TabooLib.isSilent()) { - notify = true; - TLocale.sendToConsole("COMMUNICATION.FAILED-CONNECT-SERVER"); - } return; } catch (IOException e) { TLocale.sendToConsole("COMMUNICATION.FAILED-CONNECT-CLIENT", e.getMessage());