Fixed a bug that players were not removed properly from matches or tournaments they left before the match or tournament was started.

This commit is contained in:
LevelX2 2013-04-06 02:09:04 +02:00
parent 1df4946135
commit a070c5a8e1
4 changed files with 27 additions and 2 deletions

View file

@ -281,7 +281,18 @@ public class TableController {
public synchronized void leaveTable(UUID userId) {
if (table.getState() == TableState.WAITING || table.getState() == TableState.STARTING) {
table.leaveTable(userPlayerMap.get(userId));
UUID playerId = userPlayerMap.get(userId);
if (playerId != null) {
table.leaveTable(playerId);
if (table.isTournament()) {
tournament.leave(playerId);
} else {
match.leave(playerId);
}
User user = UserManager.getInstance().getUser(userId);
user.removeTable(playerId);
userPlayerMap.remove(userId);
}
}
}