diff --git a/.classpath b/.classpath
index 186110b..d86a2de 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
diff --git a/bin/mlserver/GmsvServer.class b/bin/mlserver/GmsvServer.class
index b3a5749..1b342ee 100644
Binary files a/bin/mlserver/GmsvServer.class and b/bin/mlserver/GmsvServer.class differ
diff --git a/bin/mlserver/Handler.class b/bin/mlserver/Handler.class
index 247a576..df1fbb1 100644
Binary files a/bin/mlserver/Handler.class and b/bin/mlserver/Handler.class differ
diff --git a/bin/mlserver/MultiThreadServer.class b/bin/mlserver/MultiThreadServer.class
index 9ed38c2..f2975d6 100644
Binary files a/bin/mlserver/MultiThreadServer.class and b/bin/mlserver/MultiThreadServer.class differ
diff --git a/bin/mlserver/ServerList.class b/bin/mlserver/ServerList.class
index 7add8d0..99f4f5f 100644
Binary files a/bin/mlserver/ServerList.class and b/bin/mlserver/ServerList.class differ
diff --git a/src/mlserver/GmsvServer.java b/src/mlserver/GmsvServer.java
index 0f3132d..ea481ae 100644
--- a/src/mlserver/GmsvServer.java
+++ b/src/mlserver/GmsvServer.java
@@ -6,7 +6,21 @@ public class GmsvServer {
private String ServerName = "";
private int ServerID = 0;
private ArrayList players = null;
+ private String serverIP = "";
+ private String serverPort = "";
+ public String getServerIP() {
+ return serverIP;
+ }
+ public void setServerIP(String serverIP) {
+ this.serverIP = serverIP;
+ }
+ public String getServerPort() {
+ return serverPort;
+ }
+ public void setServerPort(String serverPort) {
+ this.serverPort = serverPort;
+ }
public GmsvServer()
{
players = new ArrayList();
@@ -94,4 +108,5 @@ public class GmsvServer {
players.remove(p);
}
}
+
}
diff --git a/src/mlserver/MultiThreadServer.java b/src/mlserver/MultiThreadServer.java
index b0ce89a..24f259f 100644
--- a/src/mlserver/MultiThreadServer.java
+++ b/src/mlserver/MultiThreadServer.java
@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.concurrent.*;
public class MultiThreadServer {
- private final int port = 9650;
+ private final int port = 9651;
private final ServerSocket serverSocket;
private final ExecutorService executorService;// 线程池
private final int POOL_SIZE = 5;// 单个CPU线程池大小
@@ -85,6 +85,8 @@ class Handler implements Runnable {
public String[] echo(final String msg) {
String []ret = null;
+ String myIP = socket.getInetAddress().toString();
+ String myPort = Integer.toString(socket.getPort());
if(msg!=null)
{
String[] packet = msg.split(" ");
@@ -97,10 +99,12 @@ class Handler implements Runnable {
GmsvServer gs = new GmsvServer();
gs.setServerName(packet[1]);
gs.setServerID(Integer.parseInt(packet[3]));
+ gs.setServerIP(myIP);
+ gs.setServerPort(myPort);
sl.addNewServer(gs);
ret = new String[1];
ret[0] = "ACServerLogin successful";
- System.out.println("Authed Server [" +packet[3] + " : " + packet[1] + "] connected... From "+socket.getInetAddress().toString() + ":" + socket.getPort() + ".");
+ System.out.println("Authed Server [" +packet[3] + " : " + packet[1] + "] connected... From "+myIP + ":" + myPort + ".");
}
}
else if(packet[0].equalsIgnoreCase("ACServerLogout") )
@@ -185,14 +189,16 @@ class Handler implements Runnable {
}
else if(packet[0].equalsIgnoreCase("ACUCheckReq"))//自动踢人
{
- /*int RegNumber = Tools.SixtyTwoScale(packet[1]);
+ int RegNumber = Tools.SixtyTwoScale(packet[1]);
String cdkey = packet[2];
- if(sl.hasCdKeyPlayer(cdkey)>0 )
+ GmsvServer gs = sl.getServerFromIP(myIP, myPort);
+ //System.out.println("ACUCheckReq "+RegNumber+" " + cdkey);
+ if(gs.findPlayer(cdkey, RegNumber)!=null && gs.findPlayer(cdkey, RegNumber).getOnline()==1)
{
-
+ //System.out.println("ACUCheckReq sent");
+ ret = new String[1];
+ ret[0] = "ACUCheck " + cdkey;
}
- ret = new String[1];
- ret[0] = "ACUCheck " + cdkey;*/
}
else if(packet[0].equalsIgnoreCase("MessageFlush"))
{
diff --git a/src/mlserver/ServerList.java b/src/mlserver/ServerList.java
index 8527ba9..9e3c0f1 100644
--- a/src/mlserver/ServerList.java
+++ b/src/mlserver/ServerList.java
@@ -45,6 +45,20 @@ public class ServerList {
return gs;
}
+ public GmsvServer getServerFromIP(String ip,String p)
+ {
+ GmsvServer gs = null;
+ for(int i=0;i