Improved reconnect and tournament handling. Reconnect time is now shown for disconneted players on player list and tournament panel. You can now reconnect (during 3 minutes) to a tournament also if meanwhile new game (after sideboarding ended) or round was started. Conceding the complete match in a tournament can no longer result in a draw, if you won games before. Quitting a tournament does now always end all active games of that quitting player.

This commit is contained in:
LevelX2 2014-03-31 02:24:59 +02:00
parent c76529bf91
commit 9ff5bcbd92
29 changed files with 282 additions and 109 deletions

View file

@ -102,13 +102,13 @@ public class UserManager {
public void disconnect(UUID userId, User.DisconnectReason reason) {
if (userId != null) {
ChatManager.getInstance().removeUser(userId, reason);
if (users.containsKey(userId)) {
User user = users.get(userId);
logger.debug(new StringBuilder("User ").append(user.getName()).append(" has lost connection userId:").append(userId));
users.get(userId).setSessionId("");
user.setSessionId(""); // Session will be set again with new id if user reconnects
ChatManager.getInstance().broadcast(userId, "has lost connection", MessageColor.BLACK);
logger.info(new StringBuilder("User ").append(user.getName()).append(" has lost connection userId:").append(userId));
}
ChatManager.getInstance().removeUser(userId, reason);
}
}
@ -143,6 +143,9 @@ public class UserManager {
return false;
}
/**
* Is the connection lost for more than 3 minutes, the user will be removed (within 3 minutes he can reconnect)
*/
private void checkExpired() {
Calendar expired = Calendar.getInstance();
expired.add(Calendar.MINUTE, -3) ;