forked from External/mage
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:
parent
c76529bf91
commit
9ff5bcbd92
29 changed files with 282 additions and 109 deletions
|
|
@ -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) ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue