TabooLib v4.57

+ 修复插件因载入顺序错误导致开服报错的问题
This commit is contained in:
坏黑 2018-10-21 13:57:45 +08:00
parent 423ad56f0c
commit 2bcc82aa15
3 changed files with 11 additions and 10 deletions

View File

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

View File

@ -93,6 +93,8 @@ public class Main extends JavaPlugin {
disable = false;
// 载入配置文件
saveDefaultConfig();
// 载入扩展
TabooLibLoader.setupAddons();
// 载入牛逼东西
TLib.init();
TLib.injectPluginManager();

View File

@ -40,7 +40,6 @@ public class TabooLibLoader implements Listener {
static void setup() {
testInternet();
setupAddons();
setupDataFolder();
setupDatabase();
setupLibraries();
@ -97,14 +96,6 @@ public class TabooLibLoader implements Listener {
metrics.addCustomChart(new Metrics.SingleLineChart("plugins_using_taboolib", () -> Math.toIntExact(Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(plugin -> plugin.getDescription().getDepend().contains("TabooLib")).count())));
}
static void setupAddons() {
TabooLib.instance().saveResource("Addons/TabooLibDeprecated.jar", true);
File file = new File(TabooLib.instance().getDataFolder(), "Addons");
if (file.exists()) {
Arrays.stream(file.listFiles()).forEach(listFile -> TDependencyLoader.addToPath(TabooLib.instance(), listFile));
}
}
static void setupDataFolder() {
Main.setPlayerDataFolder(FileUtils.folder(Main.getInst().getConfig().getString("DATAURL.PLAYER-DATA")));
Main.setServerDataFolder(FileUtils.folder(Main.getInst().getConfig().getString("DATAURL.SERVER-DATA")));
@ -116,6 +107,14 @@ public class TabooLibLoader implements Listener {
TabooLibDatabase.init();
}
static void setupAddons() {
TabooLib.instance().saveResource("Addons/TabooLibDeprecated.jar", true);
File file = new File(TabooLib.instance().getDataFolder(), "Addons");
if (file.exists()) {
Arrays.stream(file.listFiles()).forEach(listFile -> TDependencyLoader.addToPath(TabooLib.instance(), listFile));
}
}
static void setupLibraries() {
if (Main.isOfflineVersion()) {
Arrays.stream(TDependencyInjector.getDependencies(TLib.getTLib())).filter(dependency -> dependency.type() == Dependency.Type.LIBRARY && dependency.maven().matches(".*:.*:.*")).map(dependency -> String.join("-", dependency.maven().split(":")) + ".jar").forEach(fileName -> {