+ 静默更新,隐藏部分载入信息
This commit is contained in:
坏黑 2018-12-01 17:01:19 +08:00
parent 29d02a0384
commit 6f84236dcc
10 changed files with 37 additions and 26 deletions

View File

@ -6,7 +6,7 @@
<groupId>me.skymc</groupId> <groupId>me.skymc</groupId>
<artifactId>TabooLib</artifactId> <artifactId>TabooLib</artifactId>
<version>4.63</version> <version>4.64</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -6,7 +6,7 @@ import com.ilummc.tlib.dependency.TDependency;
import com.ilummc.tlib.resources.TLocale; import com.ilummc.tlib.resources.TLocale;
import com.ilummc.tlib.resources.TLocaleLoader; import com.ilummc.tlib.resources.TLocaleLoader;
import com.ilummc.tlib.util.Ref; import com.ilummc.tlib.util.Ref;
import me.skymc.taboolib.Main; import me.skymc.taboolib.TabooLib;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -14,7 +14,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@ -168,14 +167,16 @@ public class TDependencyInjector {
for (Dependency dependency : dependencies) { for (Dependency dependency : dependencies) {
if (dependency.type() == Dependency.Type.PLUGIN) { if (dependency.type() == Dependency.Type.PLUGIN) {
if (TDependency.requestPlugin(dependency.plugin())) { if (TDependency.requestPlugin(dependency.plugin())) {
TLocale.Logger.info("DEPENDENCY.PLUGIN-LOAD-SUCCESS", plugin.getName(), dependency.plugin()); TabooLib.debug(" Loaded " + dependency.plugin() + " (" + plugin.getName() + ")");
// TLocale.Logger.info("DEPENDENCY.PLUGIN-LOAD-SUCCESS", plugin.getName(), dependency.plugin());
} else { } else {
TLocale.Logger.warn("DEPENDENCY.PLUGIN-LOAD-FAIL", plugin.getName(), dependency.plugin()); TLocale.Logger.warn("DEPENDENCY.PLUGIN-LOAD-FAIL", plugin.getName(), dependency.plugin());
} }
} }
if (dependency.type() == Dependency.Type.LIBRARY) { if (dependency.type() == Dependency.Type.LIBRARY) {
if (TDependency.requestLib(dependency.maven(), dependency.mavenRepo(), dependency.url())) { if (TDependency.requestLib(dependency.maven(), dependency.mavenRepo(), dependency.url())) {
TLocale.Logger.info("DEPENDENCY.LIBRARY-LOAD-SUCCESS", plugin.getName(), String.join(":", dependency.maven())); TabooLib.debug(" Loaded " + String.join(":", dependency.maven()) + " (" + plugin.getName() + ")");
// TLocale.Logger.info("DEPENDENCY.LIBRARY-LOAD-SUCCESS", plugin.getName(), String.join(":", dependency.maven()));
} else { } else {
TLocale.Logger.warn("DEPENDENCY.LIBRARY-LOAD-FAIL", plugin.getName(), String.join(":", dependency.maven())); TLocale.Logger.warn("DEPENDENCY.LIBRARY-LOAD-FAIL", plugin.getName(), String.join(":", dependency.maven()));
} }

View File

@ -187,7 +187,7 @@ public class TabooLibLoader implements Listener {
try { try {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
List<Class> classes = FileUtils.getClasses(plugin); List<Class> classes = FileUtils.getClasses(plugin);
TLocale.Logger.info("DEPENDENCY.LOAD-CLASSES", plugin.getName(), String.valueOf(classes.size()), String.valueOf(System.currentTimeMillis() - time)); TabooLib.debug("Saved " + classes.size() + " classes (" + plugin.getName() + ") (" + (System.currentTimeMillis() - time) + "ms)");
pluginClasses.put(plugin.getName(), classes); pluginClasses.put(plugin.getName(), classes);
} catch (Exception ignored) { } catch (Exception ignored) {
} }

View File

@ -92,6 +92,7 @@ public class SimpleCommandBuilder {
return this; return this;
} }
@Deprecated
public SimpleCommandBuilder silence() { public SimpleCommandBuilder silence() {
this.silence = true; this.silence = true;
return this; return this;

View File

@ -76,8 +76,9 @@ public abstract class BaseMainCommand implements CommandExecutor, TabExecutor {
} }
}); });
} }
if (methods.size() + fields.size() > 0 && !TabooLib.isTabooLib(baseMainCommand.getRegisterCommand().getPlugin())) { if (methods.size() + fields.size() > 0) {
TLocale.Logger.info("COMMANDS.INTERNAL.COMMAND-REGISTER", baseMainCommand.getRegisterCommand().getPlugin().getName(), baseMainCommand.getRegisterCommand().getName(), String.valueOf(methods.size() + fields.size())); TabooLib.debug("Registered " + (methods.size() + fields.size()) + " sub-command with " + baseMainCommand.getRegisterCommand().getName() + " (" + baseMainCommand.getRegisterCommand().getPlugin().getName() + ")");
// TLocale.Logger.info("COMMANDS.INTERNAL.COMMAND-REGISTER", baseMainCommand.getRegisterCommand().getPlugin().getName(), baseMainCommand.getRegisterCommand().getName(), String.valueOf(methods.size() + fields.size()));
} }
} }

View File

@ -105,12 +105,13 @@ public class TCommandHandler implements Listener {
ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "permission", permission); ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "permission", permission);
ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "permissionMessage", permissionMessage); ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "permissionMessage", permissionMessage);
commandMap.register(plugin.getName(), pluginCommand); commandMap.register(plugin.getName(), pluginCommand);
if (!TabooLib.isTabooLib(plugin) && !silence) { TabooLib.debug("Command " + command + " created. (" + plugin.getName() + ")");
TLocale.Logger.info("COMMANDS.INTERNAL.COMMAND-CREATE", plugin.getName(), command); // if (!TabooLib.isTabooLib(plugin) && !silence) {
} // TLocale.Logger.info("COMMANDS.INTERNAL.COMMAND-CREATE", plugin.getName(), command);
// }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
TLocale.Logger.info("COMMANDS.INTERNAL.COMMAND-CREATE-FAILED", plugin.getName(), command, e.toString()); TLocale.Logger.error("COMMANDS.INTERNAL.COMMAND-CREATE-FAILED", plugin.getName(), command, e.toString());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }

View File

@ -70,7 +70,8 @@ public class ItemUtils {
itemName = TConfiguration.createInResource(Main.getInst(), "Language/ITEM_NAME.yml"); itemName = TConfiguration.createInResource(Main.getInst(), "Language/ITEM_NAME.yml");
itemName.listener(() -> { itemName.listener(() -> {
itemName.getConfigurationSection("").getKeys(false).forEach(a -> itemLib.put(a, itemName.getString(a))); itemName.getConfigurationSection("").getKeys(false).forEach(a -> itemLib.put(a, itemName.getString(a)));
TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-NAMES", String.valueOf(itemLib.size())); TabooLib.debug("Loaded " + itemLib.size() + " items name.");
// TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-NAMES", String.valueOf(itemLib.size()));
}).runListener(); }).runListener();
} }
@ -83,7 +84,8 @@ public class ItemUtils {
finalItemsFolder.mkdir(); finalItemsFolder.mkdir();
} }
Arrays.stream(finalItemsFolder.listFiles()).forEach(file -> loadItemsFile(file, true)); Arrays.stream(finalItemsFolder.listFiles()).forEach(file -> loadItemsFile(file, true));
TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-CACHES", String.valueOf(itemCaches.size() + itemCachesFinal.size())); TabooLib.debug("Loaded " + (itemCaches.size() + itemCachesFinal.size()) + " items.");
// TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-CACHES", String.valueOf(itemCaches.size() + itemCachesFinal.size()));
} }
public static File getItemCacheFile() { public static File getItemCacheFile() {

View File

@ -138,6 +138,11 @@ public class TellrawJson {
return components.toArray(new BaseComponent[0]); return components.toArray(new BaseComponent[0]);
} }
@Deprecated
public String getItemComponent(ItemStack item) {
return TellrawCreator.getAbstractTellraw().getItemComponent(item);
}
// ********************************* // *********************************
// //
// Private Methods // Private Methods

View File

@ -28,10 +28,10 @@ DEPENDENCY:
PLUGIN-LOAD-SUCCESS: ' {0} 请求的插件 {1} 加载成功' PLUGIN-LOAD-SUCCESS: ' {0} 请求的插件 {1} 加载成功'
PLUGIN-LOAD-FAIL: ' {0} 请求的插件 {1} 加载失败' PLUGIN-LOAD-FAIL: ' {0} 请求的插件 {1} 加载失败'
LOADING-START: '正在加载 {0} 插件所需的依赖' LOADING-START: '正在加载 {0} 插件所需的依赖'
LIBRARY-LOAD-SUCCESS: ' {0} 请求的库文件 {1} 加载成功' # LIBRARY-LOAD-SUCCESS: ' {0} 请求的库文件 {1} 加载成功'
LIBRARY-LOAD-FAIL: ' {0} 请求的库文件 {1} 加载失败' LIBRARY-LOAD-FAIL: ' {0} 请求的库文件 {1} 加载失败'
LOAD-COMPLETE: '依赖加载完成' LOAD-COMPLETE: '依赖加载完成'
LOAD-CLASSES: '&7缓存 &f{0} &7插件的 &f{1} &7个类耗时&f {2} &7毫秒.' # LOAD-CLASSES: '&7缓存 &f{0} &7插件的 &f{1} &7个类耗时&f {2} &7毫秒.'
CONFIG: CONFIG:
LOAD-FAIL-NO-ANNOTATION: '插件 {0} 的配置类 {1} 加载失败:没有 @Config 注解' LOAD-FAIL-NO-ANNOTATION: '插件 {0} 的配置类 {1} 加载失败:没有 @Config 注解'
@ -74,11 +74,11 @@ MISC:
FIELD-COPY-FAILED: '拷贝 {0} 对象失败' FIELD-COPY-FAILED: '拷贝 {0} 对象失败'
FIELD-COPY-ERROR: '拷贝 {0} 对象出错:{1}' FIELD-COPY-ERROR: '拷贝 {0} 对象出错:{1}'
COOLDOWNPACK: #COOLDOWNPACK:
PACK-REGISTER: '注册冷却包: {0}, 时间: {1} 秒 ({2})' # PACK-REGISTER: '注册冷却包: {0}, 时间: {1} 秒 ({2})'
PACK-REGISTER-ANONYMOUS: '注册冷却包: {0}, 时间: {1} 秒 (匿名注册)' # PACK-REGISTER-ANONYMOUS: '注册冷却包: {0}, 时间: {1} 秒 (匿名注册)'
PACK-UNREGISTER: '注销冷却包: {0} (主动注销)' # PACK-UNREGISTER: '注销冷却包: {0} (主动注销)'
PACK-UNREGISTER-AUTO: '注销冷却包: {0} (自动注销)' # PACK-UNREGISTER-AUTO: '注销冷却包: {0} (自动注销)'
GLOBAL-DATAMANAGER: GLOBAL-DATAMANAGER:
ERROR-CHECK-VARIABLE: '&4变量 &c{0} &4载入异常: &c{1}' ERROR-CHECK-VARIABLE: '&4变量 &c{0} &4载入异常: &c{1}'
@ -106,8 +106,8 @@ ITEM-UTILS:
FAIL-LOAD-POTION: '&c{0} &4不是一个有效的药水名称, 输入 &c/tlib potions&4 查看所有药水' FAIL-LOAD-POTION: '&c{0} &4不是一个有效的药水名称, 输入 &c/tlib potions&4 查看所有药水'
FAIL-LOAD-FLAG: '&c{0} &4不是一个有效的标签名称, 输入 &c/tlib flags&4 查看所有标签' FAIL-LOAD-FLAG: '&c{0} &4不是一个有效的标签名称, 输入 &c/tlib flags&4 查看所有标签'
FAIL-SAVE-EXISTS: '无法载入载入物品 &4{0}&c, 因为它已经存在了' FAIL-SAVE-EXISTS: '无法载入载入物品 &4{0}&c, 因为它已经存在了'
SUCCESS-LOAD-CACHES: '&7载入 &f{0} &7项缓存物品' # SUCCESS-LOAD-CACHES: '&7载入 &f{0} &7项缓存物品'
SUCCESS-LOAD-NAMES: '&7载入 &f{0} &7项物品名称' # SUCCESS-LOAD-NAMES: '&7载入 &f{0} &7项物品名称'
EMPTY-ITEM: '空' EMPTY-ITEM: '空'
LANGUAGE2: LANGUAGE2:
@ -169,9 +169,9 @@ COMMANDS:
- '&8[&3&lTabooLib&8] &7指令 &f{0} &7不存在' - '&8[&3&lTabooLib&8] &7指令 &f{0} &7不存在'
- '&8[&3&lTabooLib&8] &7你可能想要:' - '&8[&3&lTabooLib&8] &7你可能想要:'
- '&8[&3&lTabooLib&8] &7{1}' - '&8[&3&lTabooLib&8] &7{1}'
COMMAND-CREATE: '&7自动为插件 &f{0} &7的 &f{1} &7命令注册到服务器'
COMMAND-CREATE-FAILED: '&7插件 &f{0} &7的 &f{1} &7命令注册失败: &c{2}' COMMAND-CREATE-FAILED: '&7插件 &f{0} &7的 &f{1} &7命令注册失败: &c{2}'
COMMAND-REGISTER: '&7自动为插件 &f{0} &7的 &f{1} &7命令注册 &f{2} &7条子命令' # COMMAND-CREATE: '&7自动为插件 &f{0} &7的 &f{1} &7命令注册到服务器'
# COMMAND-REGISTER: '&7自动为插件 &f{0} &7的 &f{1} &7命令注册 &f{2} &7条子命令'
COMMAND-HELP: ' §f/{0} {1} {2}§6- §e{3}' COMMAND-HELP: ' §f/{0} {1} {2}§6- §e{3}'
COMMAND-ARGUMENT: '§7<§8{0}§7>' COMMAND-ARGUMENT: '§7<§8{0}§7>'
COMMAND-ARGUMENT-REQUIRE: '§7[§8{0}§7]' COMMAND-ARGUMENT-REQUIRE: '§7[§8{0}§7]'