parent
cb3a3eb341
commit
cd6c9fc606
|
@ -9,14 +9,16 @@ import cn.citycraft.CTZServer.commands.HandlerMainCommand;
|
||||||
import cn.citycraft.CTZServer.socket.CTZLoginServerSocket;
|
import cn.citycraft.CTZServer.socket.CTZLoginServerSocket;
|
||||||
import cn.citycraft.CTZServerCommon.CTZAuth;
|
import cn.citycraft.CTZServerCommon.CTZAuth;
|
||||||
import cn.citycraft.CTZServerCommon.CTZServer;
|
import cn.citycraft.CTZServerCommon.CTZServer;
|
||||||
|
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||||
import cn.citycraft.PluginHelper.sql.DataBase;
|
import cn.citycraft.PluginHelper.sql.DataBase;
|
||||||
import cn.citycraft.PluginHelper.utils.FileUtil;
|
import cn.citycraft.PluginHelper.utils.FileUtil;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
public class ServerThread implements Runnable {
|
public class ServerThread implements Runnable {
|
||||||
|
private HandlerMainCommand handlercmd;
|
||||||
protected CTZLoginServerSocket server;
|
protected CTZLoginServerSocket server;
|
||||||
protected DataBase sql;
|
protected DataBase sql;
|
||||||
private HandlerMainCommand handlercmd;
|
FileConfig config;
|
||||||
|
|
||||||
public CTZLoginServerSocket getServer() {
|
public CTZLoginServerSocket getServer() {
|
||||||
return server;
|
return server;
|
||||||
|
@ -26,6 +28,13 @@ public class ServerThread implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
CTZServer.print(ChatColor.GREEN + "服务器开始启动...");
|
CTZServer.print(ChatColor.GREEN + "服务器开始启动...");
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// config.loadFromString(FileUtil.readFile(new File("config.yml")));
|
||||||
|
// } catch (final InvalidConfigurationException e1) {
|
||||||
|
// // TODO 自动生成的 catch 块
|
||||||
|
// e1.printStackTrace();
|
||||||
|
// }
|
||||||
|
initConfig();
|
||||||
initCommand();
|
initCommand();
|
||||||
initServerInfo();
|
initServerInfo();
|
||||||
CTZAuth.init(sql, "127.0.0.1", 3306, "ctzserver", "root", "325325");
|
CTZAuth.init(sql, "127.0.0.1", 3306, "ctzserver", "root", "325325");
|
||||||
|
@ -49,6 +58,11 @@ public class ServerThread implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initConfig() {
|
||||||
|
config = new FileConfig(new File("config.yml"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化命令
|
* 初始化命令
|
||||||
*/
|
*/
|
||||||
|
@ -57,17 +71,6 @@ public class ServerThread implements Runnable {
|
||||||
handlercmd = new HandlerMainCommand(this);
|
handlercmd = new HandlerMainCommand(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化服务器信息
|
|
||||||
*/
|
|
||||||
void initConfigInfo() {
|
|
||||||
CTZServer.print(ChatColor.GREEN + "加载服务器信息...");
|
|
||||||
final File infofile = new File("config.json");
|
|
||||||
FileUtil.saveResource(this, "/config.json", infofile, false);
|
|
||||||
final String configjson = FileUtil.readFile(infofile);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化服务器信息
|
* 初始化服务器信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"mysql":
|
|
||||||
{
|
|
||||||
"ip": "127.0.0.1",
|
|
||||||
"port": 3306,
|
|
||||||
"username": "root",
|
|
||||||
"password": "",
|
|
||||||
"database": "ctzserver"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
mysql:
|
||||||
|
ip: '127.0.0.1'
|
||||||
|
port: 3306
|
||||||
|
username: 'root'
|
||||||
|
password: ''
|
||||||
|
database: 'ctzserver'
|
Loading…
Reference in New Issue