Fixed a handling bug in TournamentController. Modified some debug messages.

This commit is contained in:
LevelX2 2014-07-30 14:38:55 +02:00
parent dcf8c8e45e
commit 8bf5f01c2e
3 changed files with 14 additions and 7 deletions

View file

@ -161,7 +161,7 @@ public class ChatManager {
}
public void removeUser(UUID userId, DisconnectReason reason) {
Logger.getLogger(ChatManager.class).debug("ChatManager: Remove user start");
Logger.getLogger(ChatManager.class).debug("ChatManager: Remove user start - chatSessions: " + chatSessions.size());
for (ChatSession chat: chatSessions.values()) {
chat.kill(userId, reason);
}

View file

@ -139,6 +139,7 @@ public class ChatSession {
user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, messageType, soundToPlay)));
}
else {
logger.debug("ChatSession.broadcast user not found - killed from chat session - userId: " + userId +" chatId: " +chatId);
kill(userId, DisconnectReason.CleaningUp);
}
}

View file

@ -150,19 +150,25 @@ public class TournamentController {
public synchronized void join(UUID userId) {
UUID playerId = userPlayerMap.get(userId);
if (playerId == null) {
logger.error("join: got no playerId for userId: " + userId + " for tournament " + tournament.getId());
if (logger.isDebugEnabled()) {
User user = UserManager.getInstance().getUser(userId);
if (user != null) {
logger.debug(user.getName() + " shows tournament panel tournamentId: " + tournament.getId());
}
}
return;
}
if (tournamentSessions.containsKey(playerId)) {
logger.debug("player reopened tournament panel userId: " + userId + " tournamentId: " + tournament.getId());
return;
}
// first join of player
TournamentSession tournamentSession = new TournamentSession(tournament, userId, tableId, playerId);
if (tournamentSessions == null) {
logger.error("join: got no playerId for userId: " + userId + " for tournament " + tournament.getId());
return;
}
tournamentSessions.put(playerId, tournamentSession);
UserManager.getInstance().getUser(userId).addTournament(playerId, tournamentSession);
TournamentPlayer player = tournament.getPlayer(playerId);
player.setJoined();
logger.debug("player " + playerId + " has joined tournament " + tournament.getId());
logger.debug("player " +player.getPlayer().getName() + " - client has joined tournament " + tournament.getId());
ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getName() + " has joined the tournament", MessageColor.BLACK, true, MessageType.STATUS);
checkStart();
}