删除了自动踢人的部分,需要重写。

This commit is contained in:
Rui Fu 2012-04-18 21:43:44 +08:00
parent b8e3fcdfb1
commit 8bbf898a93
6 changed files with 44 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -48,6 +48,21 @@ public class GmsvServer {
ServerID = serverID;
}
public ArrayList<Player> hasPlyaer(String cdkey)
{
Player p = null;
ArrayList<Player> ret = new ArrayList<Player>();
//System.out.println("Server ID "+this.ServerID + " has " + this.players.size() + " players" );
for (int i=0;i<players.size();i++)
{
p = players.get(i);
//System.out.println(i + ":-> " + p.getCdkey() + " -> " + p.getRegNumber());
if(p!=null && p.getCdkey().equals(cdkey) && !ret.contains(p))
ret.add(p);
}
return ret;
}
public Player findPlayer(String cdkey,int RegNumber)
{
Player p = null;

View File

@ -183,12 +183,16 @@ class Handler implements Runnable {
ml.writeToFile();
}
}
else if(packet[0].equalsIgnoreCase("ACUCheckReq"))
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 )
{
}
ret = new String[1];
ret[0] = "ACUCheck " + cdkey;
ret[0] = "ACUCheck " + cdkey;*/
}
else if(packet[0].equalsIgnoreCase("MessageFlush"))
{

View File

@ -45,6 +45,28 @@ public class ServerList {
return gs;
}
public int hasCdKeyPlayer(String cdkey)
{
//System.out.println("Looking for "+ cdkey+ " rn: " + rn);
//System.out.println("Server Num: "+ servers.size());
ArrayList<Player> p = null;
int ret = 0;
GmsvServer gs = null;
for(int i=0;i<servers.size();i++)
{
gs = servers.get(i);
p = gs.hasPlyaer(cdkey);
if(p.size()>0)
{
for(int j = 0; j<p.size();j++){
Player pl = p.get(j);
ret+=pl.getOnline();
}
}
}
return ret;
}
public Player getPlayer(String cdkey,int rn)
{
//System.out.println("Looking for "+ cdkey+ " rn: " + rn);