From 78a5f6ce4f61167132c11201e422bd35674fcab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Sat, 6 Jul 2019 00:39:56 +0800 Subject: [PATCH] final version --- build.gradle | 2 +- src/main/resources/motd.txt | 10 ---------- src/main/scala/me/skymc/taboolib/Main.java | 18 ------------------ .../commands/internal/BaseMainCommand.java | 6 +++--- .../taboolib/database/PlayerDataManager.java | 9 +-------- .../skymc/taboolib/playerdata/DataUtils.java | 8 +------- 6 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 src/main/resources/motd.txt diff --git a/build.gradle b/build.gradle index 6c2683c..270adef 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'com.github.johnrengelman.shadow' version '4.0.4' } group = 'me.skymc' -version = '4.86' +version = '4.9' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/src/main/resources/motd.txt b/src/main/resources/motd.txt deleted file mode 100644 index 2d271a9..0000000 --- a/src/main/resources/motd.txt +++ /dev/null @@ -1,10 +0,0 @@ -§r -§r -§b________ §b______ §f______§8___________ -§b___ __/§3_____ §b___ /§3_____________§f___ /§8___(_)__ /_ -§b__ / §3_ __ `/§b_ __ \§3 __ \ __ \§f_ / §8__ /__ __ \ -§b_ / §3/ /_/ /§b_ /_/ /§3 /_/ / /_/ /§f /___§8 / _ /_/ / -§b/_/ §3\__,_/ §b/_.___/§3\____/\____/§f/_____/§8_/ /_.___/ -§r - §8version §f{0} -§r \ No newline at end of file diff --git a/src/main/scala/me/skymc/taboolib/Main.java b/src/main/scala/me/skymc/taboolib/Main.java index 175fe03..f4760f7 100644 --- a/src/main/scala/me/skymc/taboolib/Main.java +++ b/src/main/scala/me/skymc/taboolib/Main.java @@ -3,13 +3,10 @@ package me.skymc.taboolib; import com.ilummc.tlib.TLib; import com.ilummc.tlib.filter.TLoggerFilter; import com.ilummc.tlib.resources.TLocale; -import com.ilummc.tlib.util.IO; -import com.ilummc.tlib.util.Strings; import me.skymc.taboolib.database.GlobalDataManager; import me.skymc.taboolib.database.PlayerDataManager; import me.skymc.taboolib.economy.EcoUtils; import me.skymc.taboolib.fileutils.ConfigUtils; -import me.skymc.taboolib.fileutils.FileUtils; import me.skymc.taboolib.listener.TListenerHandler; import me.skymc.taboolib.mysql.hikari.HikariHandler; import me.skymc.taboolib.mysql.protect.MySQLConnection; @@ -24,10 +21,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.Arrays; import java.util.Random; /** @@ -114,17 +107,6 @@ public class Main extends JavaPlugin { @Override public void run() { - // 面子工程 - if (!TabooLib.isSilent()) { - InputStream inputStream = FileUtils.getResource("motd.txt"); - try { - String text = new String(IO.readFully(inputStream), Charset.forName("utf-8")); - if (text != null) { - Arrays.stream(text.split("\n")).forEach(line -> Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(line, getDescription().getVersion()))); - } - } catch (IOException ignored) { - } - } // 本地通讯网络终端 if (getConfig().getBoolean("SERVER")) { TabooLibServer.main(new String[0]); diff --git a/src/main/scala/me/skymc/taboolib/commands/internal/BaseMainCommand.java b/src/main/scala/me/skymc/taboolib/commands/internal/BaseMainCommand.java index 6f10d22..a44d7da 100644 --- a/src/main/scala/me/skymc/taboolib/commands/internal/BaseMainCommand.java +++ b/src/main/scala/me/skymc/taboolib/commands/internal/BaseMainCommand.java @@ -11,7 +11,7 @@ import me.skymc.taboolib.string.StringUtils; import org.bukkit.Bukkit; import org.bukkit.command.*; import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; import java.lang.reflect.Field; @@ -206,10 +206,10 @@ public abstract class BaseMainCommand implements CommandExecutor, TabExecutor { } private void disguisedPlugin() { - linkClasses.forEach(clazz -> disguisedPlugin(clazz, (JavaPlugin) registerCommand.getPlugin())); + linkClasses.forEach(clazz -> disguisedPlugin(clazz, registerCommand.getPlugin())); } - private void disguisedPlugin(Class targetClass, JavaPlugin plugin) { + private void disguisedPlugin(Class targetClass, Plugin plugin) { try { Field pluginField = targetClass.getClassLoader().getClass().getDeclaredField("plugin"); pluginField.setAccessible(true); diff --git a/src/main/scala/me/skymc/taboolib/database/PlayerDataManager.java b/src/main/scala/me/skymc/taboolib/database/PlayerDataManager.java index 93871a7..217bfd3 100644 --- a/src/main/scala/me/skymc/taboolib/database/PlayerDataManager.java +++ b/src/main/scala/me/skymc/taboolib/database/PlayerDataManager.java @@ -180,15 +180,8 @@ public class PlayerDataManager implements Listener { @Override public void run() { - long time = System.currentTimeMillis(); // 保存 - for (String name : PLAYER_DATA.keySet()) { - savePlayerData(name, false); - } - // 提示 - if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { - TLocale.Logger.info("PLAYER-DATAMANAGER.SUCCESS-SAVE-DATA", String.valueOf(PLAYER_DATA.size()), String.valueOf(System.currentTimeMillis() - time)); - } + PLAYER_DATA.keySet().forEach(name -> savePlayerData(name, false)); } }; // 如果异步 diff --git a/src/main/scala/me/skymc/taboolib/playerdata/DataUtils.java b/src/main/scala/me/skymc/taboolib/playerdata/DataUtils.java index d5e0abb..a80089a 100644 --- a/src/main/scala/me/skymc/taboolib/playerdata/DataUtils.java +++ b/src/main/scala/me/skymc/taboolib/playerdata/DataUtils.java @@ -46,13 +46,7 @@ public class DataUtils implements Listener { } public static void saveAllCaches(boolean remove) { - long time = System.currentTimeMillis(); - for (String plugin : CACHE_DATA_PLUGIN.keySet()) { - saveAllCaches(getFixedPlugin(plugin), remove); - } - if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { - TLocale.Logger.info("DATA-UTILS.SUCCESS-SAVE-DATA", String.valueOf(DataUtils.CACHE_DATA_PLUGIN.size()), String.valueOf(System.currentTimeMillis() - time)); - } + CACHE_DATA_PLUGIN.keySet().forEach(plugin -> saveAllCaches(getFixedPlugin(plugin), remove)); } public static void saveConfiguration(FileConfiguration conf, File file) {