This commit is contained in:
坏黑 2019-07-06 22:42:05 +08:00
parent 2938b6c463
commit e864468539
3 changed files with 3 additions and 28 deletions

View File

@ -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();
}
}

View File

@ -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();
// 关闭服务器

View File

@ -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());