refactor: 将 PlaceholderAPI 初始化逻辑移至服务器启动后执行
Some checks failed
Publish Project / build (push) Failing after 3m47s

This commit is contained in:
2026-01-20 14:23:23 +08:00
parent 05bd72d01b
commit 5e1b591933
2 changed files with 11 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ plugins {
} }
group = "cn.hamster3.mc.plugin" group = "cn.hamster3.mc.plugin"
version = "3.1.3-SNAPSHOT" version = "3.1.4-SNAPSHOT"
repositories { repositories {
maven("https://maven.airgame.net/maven-public/") maven("https://maven.airgame.net/maven-public/")

View File

@@ -54,14 +54,6 @@ public class CurrencyPlugin extends JavaPlugin {
} catch (SQLException e) { } catch (SQLException e) {
error(e); error(e);
} }
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
logger.info("检测到 PlaceholderAPI 已安装");
if (PlaceholderHook.INSTANCE.register()) {
logger.info("已挂载 PlaceholderAPI 变量");
}
} else {
logger.info("未检测到 PlaceholderAPI");
}
long time = System.currentTimeMillis() - start; long time = System.currentTimeMillis() - start;
logger.info("仓鼠经济初始化完成,总计耗时 " + time + " ms"); logger.info("仓鼠经济初始化完成,总计耗时 " + time + " ms");
} }
@@ -87,6 +79,16 @@ public class CurrencyPlugin extends JavaPlugin {
} else { } else {
logger.info("不进行 Vault 经济系统注册"); logger.info("不进行 Vault 经济系统注册");
} }
sync(() -> {
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
logger.info("检测到 PlaceholderAPI 已安装");
if (PlaceholderHook.INSTANCE.register()) {
logger.info("已挂载 PlaceholderAPI 变量");
}
} else {
logger.info("未检测到 PlaceholderAPI");
}
});
long time = System.currentTimeMillis() - start; long time = System.currentTimeMillis() - start;
logger.info("仓鼠经济启动完成,总计耗时 " + time + " ms"); logger.info("仓鼠经济启动完成,总计耗时 " + time + " ms");
} }