1
0
mirror of https://e.coding.net/circlecloud/CTZServer.git synced 2024-11-24 11:58:46 +00:00

update...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-09-09 20:47:47 +08:00
parent 35f426cada
commit 9374fa8dd0
2 changed files with 25 additions and 16 deletions

View File

@ -4,12 +4,12 @@ import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import cn.citycraft.CTZServer.commands.HandlerCommand; import cn.citycraft.CTZServer.commands.HandlerCommand;
import cn.citycraft.CTZServer.socket.CTZLoginServerSocket; import cn.citycraft.CTZServer.socket.CTZLoginServerSocket;
import cn.citycraft.sql.KeyValue;
import cn.citycraft.sql.MySQLHelper; import cn.citycraft.sql.MySQLHelper;
import cn.citycraft.sql.SQLHelper; import cn.citycraft.sql.SQLHelper;
import cn.citycraft.utils.FileUtil; import cn.citycraft.utils.FileUtil;
@ -72,19 +72,18 @@ public class ServerThread implements Runnable {
CTZServer.getLogger().info("数据库连接成功,检查数据表是否存在..."); CTZServer.getLogger().info("数据库连接成功,检查数据表是否存在...");
if (!sql.isTableExists(dbtable)) { if (!sql.isTableExists(dbtable)) {
CTZServer.getLogger().info("数据表不存在,新建表" + dbtable + "..."); CTZServer.getLogger().info("数据表不存在,新建表" + dbtable + "...");
HashMap<String, String> fields = new HashMap<String, String>(); KeyValue kv = new KeyValue("player", "VARCHAR(16) NOT NULL")
fields.put("player", "VARCHAR(16) NOT NULL"); .add("password", "VARCHAR(50) NOT NULL")
fields.put("password", "VARCHAR(50) NOT NULL"); .add("ip", "varchar(40) NOT NULL")
fields.put("ip", "varchar(40) NOT NULL"); .add("lastloginout", "BIGINT(20) NOT NULL")
fields.put("lastloginout", "BIGINT(20) NOT NULL"); .add("x", "DOUBLE NOT NULL")
fields.put("x", "DOUBLE NOT NULL"); .add("y", "DOUBLE NOT NULL")
fields.put("y", "DOUBLE NOT NULL"); .add("z", "DOUBLE NOT NULL")
fields.put("z", "DOUBLE NOT NULL"); .add("email", "VARCHAR(50)")
fields.put("email", "VARCHAR(50)"); .add("world", "SMALLINT(6)")
fields.put("world", "SMALLINT(6)"); .add("islogged", "SMALLINT(6) NOT NULL");
fields.put("islogged", "SMALLINT(6) NOT NULL");
String Conditions = "UNIQUE (`player`)"; String Conditions = "UNIQUE (`player`)";
if (!sql.createTables(dbtable, fields, Conditions)) if (!sql.createTables(dbtable, kv, Conditions))
CTZServer.getLogger().warning("数据表" + dbtable + "创建失败,请尝试手动创建并重启服务器..."); CTZServer.getLogger().warning("数据表" + dbtable + "创建失败,请尝试手动创建并重启服务器...");
} }
} }

View File

@ -18,11 +18,21 @@ public class AuthModule {
private String ip; private String ip;
@Column @Column
private String x; private long x;
@Column @Column
private String y; private long y;
@Column @Column
private String z; private long z;
@Column
private String world;
@Column
private long lastlogout;
@Column
private boolean islogin;
} }