From b433c54ad839c2f33368220847e4eee85351b615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Thu, 11 Jul 2019 16:59:18 +0800 Subject: [PATCH] Change module load priority --- src/main/resources/__resources__/lang/internal.yml | 4 +++- src/main/resources/__resources__/lang/zh_CN.yml | 4 ---- src/main/scala/io/izzel/taboolib/PluginLoader.java | 4 ++-- .../io/izzel/taboolib/module/dependency/TDependency.java | 4 ++-- .../taboolib/module/dependency/TDependencyInjector.java | 5 +++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/resources/__resources__/lang/internal.yml b/src/main/resources/__resources__/lang/internal.yml index 3a1f124..3ff54b7 100644 --- a/src/main/resources/__resources__/lang/internal.yml +++ b/src/main/resources/__resources__/lang/internal.yml @@ -5,4 +5,6 @@ ERROR-LOADING-LANG: '加载 {0} 插件的语言文件时发生异常:{1}' FETCH-LOCALE-ERROR: '语言文件获取失败:{0}' SEND-LOCALE-ERROR: '语言文件发送失败:{0}' LOCALE-ERROR-REASON: '原因:{0}' -MISSING-ARGUMENT: '语言文本含有没有找到的参数 {0}' \ No newline at end of file +MISSING-ARGUMENT: '语言文本含有没有找到的参数 {0}' +DEPENDENCY-DOWNLOAD-START: ' 正在下载 {0} 库文件' +DEPENDENCY-LOAD-FAIL: ' {0} 请求的库文件 {1} 加载失败' \ No newline at end of file diff --git a/src/main/resources/__resources__/lang/zh_CN.yml b/src/main/resources/__resources__/lang/zh_CN.yml index 307caf1..4ecf5ae 100644 --- a/src/main/resources/__resources__/lang/zh_CN.yml +++ b/src/main/resources/__resources__/lang/zh_CN.yml @@ -1,7 +1,3 @@ -DEPENDENCY: - DOWNLOAD-START: ' 正在下载 {0} 库文件' - LIBRARY-LOAD-FAIL: ' {0} 请求的库文件 {1} 加载失败' - LOCALE: TITLE-SEND-TO-NON-PLAYER: '该语言类型只能发送给玩家:{0}' PLUGIN-NOT-FOUND: '无效的语言文件发送形式: &4{0}' diff --git a/src/main/scala/io/izzel/taboolib/PluginLoader.java b/src/main/scala/io/izzel/taboolib/PluginLoader.java index ed734b6..c12ded2 100644 --- a/src/main/scala/io/izzel/taboolib/PluginLoader.java +++ b/src/main/scala/io/izzel/taboolib/PluginLoader.java @@ -33,10 +33,10 @@ public abstract class PluginLoader { @Override public void onLoading(Plugin plugin) { - // 加载语言文件 - TLocaleLoader.load(plugin, false); // 注入依赖 TDependencyInjector.inject(plugin, plugin.getClass()); + // 加载语言文件 + TLocaleLoader.load(plugin, false); // 读取插件类 TabooLibLoader.setupClasses(plugin); // 加载插件类 diff --git a/src/main/scala/io/izzel/taboolib/module/dependency/TDependency.java b/src/main/scala/io/izzel/taboolib/module/dependency/TDependency.java index a35d5e1..033f6a1 100644 --- a/src/main/scala/io/izzel/taboolib/module/dependency/TDependency.java +++ b/src/main/scala/io/izzel/taboolib/module/dependency/TDependency.java @@ -1,8 +1,8 @@ package io.izzel.taboolib.module.dependency; import io.izzel.taboolib.TabooLib; -import io.izzel.taboolib.module.locale.TLocale; import io.izzel.taboolib.util.Files; +import io.izzel.taboolib.util.Strings; import java.io.File; import java.util.Arrays; @@ -57,7 +57,7 @@ public class TDependency { } private static boolean downloadMaven(String url, String groupId, String artifactId, String version, File target, String dl) { - TLocale.Logger.info("DEPENDENCY.DOWNLOAD-START", target.getName()); + TabooLib.getLogger().info(Strings.replaceWithOrder(TabooLib.getInst().getInternal().getString("DEPENDENCY-DOWNLOAD-START"), target.getName())); return Files.downloadFile(dl.length() == 0 ? url + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".jar" : dl, Files.file(target)); } } diff --git a/src/main/scala/io/izzel/taboolib/module/dependency/TDependencyInjector.java b/src/main/scala/io/izzel/taboolib/module/dependency/TDependencyInjector.java index c35294c..f38b6db 100644 --- a/src/main/scala/io/izzel/taboolib/module/dependency/TDependencyInjector.java +++ b/src/main/scala/io/izzel/taboolib/module/dependency/TDependencyInjector.java @@ -1,7 +1,8 @@ package io.izzel.taboolib.module.dependency; +import io.izzel.taboolib.TabooLib; import io.izzel.taboolib.TabooLibAPI; -import io.izzel.taboolib.module.locale.TLocale; +import io.izzel.taboolib.util.Strings; import org.bukkit.plugin.Plugin; /** @@ -32,7 +33,7 @@ public class TDependencyInjector { if (TDependency.requestLib(dependency.maven(), dependency.mavenRepo(), dependency.url())) { TabooLibAPI.debug(" Loaded " + String.join(":", dependency.maven()) + " (" + name + ")"); } else { - TLocale.Logger.warn("DEPENDENCY.LIBRARY-LOAD-FAIL", name, String.join(":", dependency.maven())); + TabooLib.getLogger().warn(Strings.replaceWithOrder(TabooLib.getInst().getInternal().getString("DEPENDENCY-LOAD-FAIL"), name, String.join(":", dependency.maven()))); } } }