package pickup;
import server.server;
import team.team;
public class pickup extends Thread {
private team TeamA;
private team TeamB;
private server myServer;
public pickup()
{
}
public void run()
{
this.TeamA = new team();
this.TeamB = new team();
this.myServer=new server();
}
public team getTeamA()
{
return this.TeamA;
}
public team getTeamB()
{
return this.TeamB;
}
public void setTeamA(team newteam)
{
TeamA=newteam;
}
public void setTeamB(team newteam)
{
TeamB=newteam;
}
public server getServer()
{
return this.myServer;
}
public void setServer(server newserver)
{
this.myServer=newserver;
}
public void removePlayer(String name_or_mask)
{
//name = name or mask
if(getTeamA().getPlayerIdByAddress(name_or_mask)!=999)
{
getTeamA().resetPlayer(getTeamA().getPlayerIdByAddress(name_or_mask));
}
else if(getTeamB().getPlayerIdByAddress(name_or_mask)!=999)
{
getTeamB().resetPlayer(getTeamB().getPlayerIdByAddress(name_or_mask));
}
else if(getTeamA().getPlayerIdByName(name_or_mask)!=999)
{
getTeamA().resetPlayer(getTeamA().getPlayerIdByName(name_or_mask));
}
else if(getTeamB().getPlayerIdByName(name_or_mask)!=999)
{
getTeamB().resetPlayer(getTeamB().getPlayerIdByName(name_or_mask));
}
}
public boolean isNotAlreadyRegistered(String sender, String hostname)
{
boolean result=true;
if(getTeamA().getPlayerIdByAddress(hostname)!=999)
{
result=false;
}
else if(getTeamB().getPlayerIdByAddress(hostname)!=999)
{
result=false;
}
else if(getTeamA().getPlayerIdByName(sender)!=999)
{
result=false;
}
else if(getTeamB().getPlayerIdByName(sender)!=999)
{
result=false;
}
return result;
}
public boolean isRegistered(String sender, String hostname)
{
boolean result=false;
if(getTeamA().getPlayerIdByAddress(hostname)!=999)
{
result=true;
}
else if(getTeamB().getPlayerIdByAddress(hostname)!=999)
{
result=true;
}
else if(getTeamA().getPlayerIdByName(sender)!=999)
{
result=true;
}
else if(getTeamB().getPlayerIdByName(sender)!=999)
{
result=true;
}
return result;
}
}