I have a small chunk of code here, and it's called when somebody switches channels in TeamSpeak. The clid
is the user's ID, and the cid
is the channel ID. Integers lobby
and verified
are preset IDs representing the 'Tournament Lobby' and 'Name Verified' channels, and reg
is a Vector
of IDs to determine who is in the lobby. the only other references to reg
outside this function are its declaration and initialization. Here's the code:
public void handleClientMove(int clid, int cid)
{
String name = query.getClientNameFromID(clid);
System.out.println(cid == lobby ? "lobby" : cid == verified ? "verified" : "non-tournament");
if(cid == lobby)
{
System.out.println("Handling Tournament Lobby");
if(!reg.contains(clid))
{
query.clientPoke(clid, "Welcome to the Tourney! Please change your name to include your rank. ex: 'D5 Name', 'M1 Name2'");
reg.add(clid);
}
}
else
{
if(reg.contains(clid)) reg.remove(clid);
}
System.out.println("test01");
if(cid == verified)
{
System.out.println("Handling Name Verified");
if(!isUserRegistered(clid))
{
participants.add(new Player(name, clid, true));
query.clientPoke(clid, "Your name has been verified and you are now entered in the tournament!");
}
}
}
The println
statements are solely for debug purposes. When I switch the channel to the lobby (I can validate that the correct clid
and cid
were passed in because of the debug statements) it works fine, but when I join the Name Verified channel (once again, proper parameters here) nothing happens.. at all. the println
statement at the top of the method runs, but the one between the if
blocks is not, so it seems to me like something is preventing it from getting past the first block, even though it's not being run. Any help would be greatly appreciated. Thanks!
If "verified" is being printed but "test01" is not, the program must therefore be stuck in an infinite loop inside if(reg.contains(clid)) reg.remove(clid);
. If reg is of your class, debug it; if it is of a collections class, ensure that you are not improperly concurrently modifying it.