feat: 仓鼠球链接Redis失败时关闭服务器

This commit is contained in:
2024-03-08 10:00:36 +08:00
parent 41ea7ade9c
commit ea0c3e005b
3 changed files with 7 additions and 1 deletions

View File

@@ -56,7 +56,11 @@ public class HamsterBallPlugin extends JavaPlugin {
try { try {
BallBukkitAPI.getInstance().enable(); BallBukkitAPI.getInstance().enable();
} catch (Exception e) { } catch (Exception e) {
getLogger().info("仓鼠球启动失败,原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
getLogger().info("由于仓鼠球启动失败,服务器将立即关闭");
Bukkit.shutdown();
return;
} }
Bukkit.getPluginManager().registerEvents(BallBukkitListener.INSTANCE, this); Bukkit.getPluginManager().registerEvents(BallBukkitListener.INSTANCE, this);
BallAPI.getInstance().getEventBus().register(BallBukkitListener.INSTANCE); BallAPI.getInstance().getEventBus().register(BallBukkitListener.INSTANCE);

View File

@@ -84,7 +84,9 @@ public class HamsterBallPlugin extends Plugin {
try { try {
BallBungeeCordAPI.getInstance().disable(); BallBungeeCordAPI.getInstance().disable();
} catch (Exception e) { } catch (Exception e) {
getLogger().info("仓鼠球启动失败,原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
ProxyServer.getInstance().stop("由于仓鼠球启动失败,服务器将立即关闭");
} }
long time = System.currentTimeMillis() - start; long time = System.currentTimeMillis() - start;
logger.info("仓鼠球已关闭,总计耗时 " + time + " ms"); logger.info("仓鼠球已关闭,总计耗时 " + time + " ms");

View File

@@ -5,7 +5,7 @@ plugins {
} }
group = "cn.hamster3.mc.plugin" group = "cn.hamster3.mc.plugin"
version = "1.5.4" version = "1.5.5"
subprojects { subprojects {
apply { apply {