diff --git a/src/main/java/cn/citycraft/CTZServer/CTZAuth.java b/src/main/java/cn/citycraft/CTZServer/CTZAuth.java index a072ae7..de213ce 100644 --- a/src/main/java/cn/citycraft/CTZServer/CTZAuth.java +++ b/src/main/java/cn/citycraft/CTZServer/CTZAuth.java @@ -1,13 +1,14 @@ package cn.citycraft.CTZServer; -import cn.citycraft.sql.KeyValue; -import cn.citycraft.sql.SQLHelper; -import cn.citycraft.utils.StringUtil; +import cn.citycraft.PluginHelper.sql.KeyValue; +import cn.citycraft.PluginHelper.sql.SQLHelper; +import cn.citycraft.PluginHelper.utils.StringUtil; public class CTZAuth { static final String TableName = "ctzserver"; static final String UserField = "player"; static final String PWDField = "password"; + static final String LoginField = "password"; static ServerThread serverThread; static SQLHelper sql; @@ -25,7 +26,7 @@ public class CTZAuth { } public static boolean isLogin(String username) { - String result = sql.dbSelectFirst(TableName, "islogged", new KeyValue(UserField, username)); + String result = sql.dbSelectFirst(TableName, LoginField, new KeyValue(UserField, username)); return (result != null && result.equalsIgnoreCase("1")); } @@ -33,6 +34,10 @@ public class CTZAuth { return sql.isFieldExists(TableName, new KeyValue(UserField, username)); } + public static boolean login(String username) { + return sql.dbUpdate(TableName, new KeyValue(LoginField, "1"), new KeyValue(UserField, username)); + } + public static boolean registerPlayer(String username, String password) { if (isRegistered(username)) return false; diff --git a/src/main/java/cn/citycraft/CTZServer/ServerThread.java b/src/main/java/cn/citycraft/CTZServer/ServerThread.java index 9530407..2c427d4 100644 --- a/src/main/java/cn/citycraft/CTZServer/ServerThread.java +++ b/src/main/java/cn/citycraft/CTZServer/ServerThread.java @@ -7,10 +7,10 @@ import java.io.InputStreamReader; import cn.citycraft.CTZServer.commands.HandlerCommand; import cn.citycraft.CTZServer.socket.CTZLoginServerSocket; -import cn.citycraft.sql.KeyValue; -import cn.citycraft.sql.MySQLHelper; -import cn.citycraft.sql.SQLHelper; -import cn.citycraft.utils.FileUtil; +import cn.citycraft.PluginHelper.sql.KeyValue; +import cn.citycraft.PluginHelper.sql.MySQLHelper; +import cn.citycraft.PluginHelper.sql.SQLHelper; +import cn.citycraft.PluginHelper.utils.FileUtil; import net.md_5.bungee.api.ChatColor; public class ServerThread implements Runnable { diff --git a/src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java b/src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java index 966e344..c6003ee 100644 --- a/src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java +++ b/src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java @@ -2,8 +2,8 @@ package cn.citycraft.CTZServer.commands; import cn.citycraft.CTZServer.CTZServer; import cn.citycraft.CTZServer.ServerThread; -import cn.citycraft.utils.StringUtil; -import cn.citycraft.utils.SystemUtil; +import cn.citycraft.PluginHelper.utils.StringUtil; +import cn.citycraft.PluginHelper.utils.SystemUtil; import net.md_5.bungee.api.ChatColor; public class CommandGc extends BaseCommand { diff --git a/src/main/java/cn/citycraft/CTZServer/commands/HandlerCommand.java b/src/main/java/cn/citycraft/CTZServer/commands/HandlerCommand.java index 38f3ea7..c82f6b9 100644 --- a/src/main/java/cn/citycraft/CTZServer/commands/HandlerCommand.java +++ b/src/main/java/cn/citycraft/CTZServer/commands/HandlerCommand.java @@ -5,7 +5,7 @@ import java.util.List; import cn.citycraft.CTZServer.CTZServer; import cn.citycraft.CTZServer.ServerThread; -import cn.citycraft.utils.StringUtil; +import cn.citycraft.PluginHelper.utils.StringUtil; import net.md_5.bungee.api.ChatColor; public class HandlerCommand {