public synchronized void join(UUID userId) {
UUID playerId = userPlayerMap.get(userId);
if (playerId == null) {
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);
tournamentSessions.put(playerId, tournamentSession);
User user = UserManager.getInstance().getUser(userId);
if (user != null) {
user.addTournament(playerId, tournamentSession);
TournamentPlayer player = tournament.getPlayer(playerId);
player.setJoined();
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();