Merge pull request #30 from magefree/master

merge
This commit is contained in:
theelk801 2017-08-16 08:41:08 -04:00 committed by GitHub
commit edb6ba181e
4 changed files with 11 additions and 5 deletions

1
.gitignore vendored
View file

@ -44,6 +44,7 @@ Mage.Server.Plugins/Mage.Game.CommanderDuel/target
Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/target/
Mage.Server.Plugins/Mage.Game.FreeForAll/target
Mage.Server.Plugins/Mage.Game.MomirDuel/target
Mage.Server.Plugins/Mage.Game.PennyDreadfulCommanderFreeForAll/target
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
Mage.Server.Plugins/Mage.Player.AI.DraftBot/target

View file

@ -1440,7 +1440,7 @@ public class SessionImpl implements Session {
@Override
public boolean endUserSession(String userSessionId) {
try {
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute userSessionId " + userSessionId + '?', "WARNING",
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to end userSessionId " + userSessionId + '?', "WARNING",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
if (isConnected()) {
server.endUserSession(sessionId, userSessionId);

View file

@ -4,9 +4,9 @@ package mage.server;
*
* @author LevelX2
*/
public enum DisconnectReason {
LostConnection(" has lost connection"),
BecameInactive(" has become inactive"),
Disconnected(" has left XMage"),
CleaningUp(" [cleaning up]"),
ConnectingOtherInstance(" reconnected and replaced still active old session"),
@ -15,11 +15,12 @@ public enum DisconnectReason {
Undefined("");
String message;
DisconnectReason(String message){
DisconnectReason(String message) {
this.message = message;
}
public String getMessage(){
public String getMessage() {
return message;
}
}

View file

@ -174,8 +174,12 @@ public enum UserManager {
calendarRemove.add(Calendar.MINUTE, -8);
List<User> toRemove = new ArrayList<>();
for (User user : users.values()) {
if (user.getUserState() == UserState.Disconnected || user.getUserState() == UserState.Offline
if (user.getUserState() != UserState.Offline
&& user.isExpired(calendarExp.getTime())) {
if (user.getUserState() == UserState.Connected) {
user.lostConnection();
disconnect(user.getId(), DisconnectReason.BecameInactive);
}
user.setUserState(UserState.Offline);
}
if (user.getUserState() == UserState.Offline && user.isExpired(calendarRemove.getTime())) {