mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2024-12-19 23:38:53 +08:00
数据库新增自动重连机制,允许修改配置文件后直接重连不必再重启服务器
This commit is contained in:
parent
0e638e00b2
commit
a321e39fe5
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "cn.lunadeer"
|
||||
version = "2.1.18-beta"
|
||||
version = "2.1.19-beta"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
|
@ -7,6 +7,8 @@ import cn.lunadeer.dominion.utils.MapRender;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import cn.lunadeer.minecraftpluginutils.Scheduler;
|
||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||
import cn.lunadeer.minecraftpluginutils.databse.DatabaseManager;
|
||||
import cn.lunadeer.minecraftpluginutils.databse.DatabaseType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.io.File;
|
||||
@ -121,6 +123,14 @@ public class Operator {
|
||||
Scheduler.runTaskAsync(() -> {
|
||||
Notification.info(sender, "正在重新加载配置文件...");
|
||||
Dominion.config.reload();
|
||||
DatabaseManager.instance.reConnection(
|
||||
DatabaseType.valueOf(Dominion.config.getDbType().toUpperCase()),
|
||||
Dominion.config.getDbHost(),
|
||||
Dominion.config.getDbPort(),
|
||||
Dominion.config.getDbName(),
|
||||
Dominion.config.getDbUser(),
|
||||
Dominion.config.getDbPass()
|
||||
);
|
||||
Notification.info(sender, "配置文件已重新加载");
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user