mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[minor] Some formatting, remove unused code, changes to logging.
This commit is contained in:
parent
7df016ecf8
commit
31da9dcdfd
4 changed files with 10 additions and 13 deletions
|
@ -44,9 +44,7 @@ public class GameClientMessage implements Serializable {
|
|||
private CardsView cardsView;
|
||||
private CardsView cardsView2;
|
||||
private String message;
|
||||
private AbilityPickerView abilityView;
|
||||
private boolean flag;
|
||||
private boolean cancel;
|
||||
private String[] strings;
|
||||
private Set<UUID> targets;
|
||||
private int min;
|
||||
|
@ -109,10 +107,6 @@ public class GameClientMessage implements Serializable {
|
|||
return message;
|
||||
}
|
||||
|
||||
public AbilityPickerView getAbilityView() {
|
||||
return abilityView;
|
||||
}
|
||||
|
||||
public boolean isFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,9 @@ public class Session {
|
|||
|
||||
public void registerUser(String userName) throws MageException {
|
||||
this.isAdmin = false;
|
||||
if (userName.equals("Admin"))
|
||||
if (userName.equals("Admin")) {
|
||||
throw new MageException("User name already in use");
|
||||
}
|
||||
if (userName.length() > ConfigSettings.getInstance().getMaxUserNameLength()) {
|
||||
throw new MageException(new StringBuilder("User name may not be longer than ").append(ConfigSettings.getInstance().getMaxUserNameLength()).append(" characters").toString());
|
||||
}
|
||||
|
@ -87,8 +88,9 @@ public class Session {
|
|||
if (user == null) { // user already exists
|
||||
user = UserManager.getInstance().findUser(userName);
|
||||
if (user.getHost().equals(host)) {
|
||||
if (user.getSessionId().isEmpty())
|
||||
if (user.getSessionId().isEmpty()) {
|
||||
logger.info("Reconnecting session for " + userName);
|
||||
}
|
||||
else {
|
||||
//throw new MageException("This machine is already connected");
|
||||
//disconnect previous one
|
||||
|
@ -100,8 +102,9 @@ public class Session {
|
|||
throw new MageException("User name already in use");
|
||||
}
|
||||
}
|
||||
if (!UserManager.getInstance().connectToSession(sessionId, user.getId()))
|
||||
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
|
||||
throw new MageException("Error connecting");
|
||||
}
|
||||
this.userId = user.getId();
|
||||
}
|
||||
|
||||
|
|
|
@ -102,14 +102,14 @@ public class User {
|
|||
this.sessionId = sessionId;
|
||||
if (sessionId.isEmpty()) {
|
||||
userState = UserState.Disconnected;
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" disconnected").toString());
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" disconnected - userId = ").append(userId.toString()).toString());
|
||||
} else if (userState == UserState.Created) {
|
||||
userState = UserState.Connected;
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" created").toString());
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" created - userId = ").append(userId.toString()).toString());
|
||||
} else {
|
||||
userState = UserState.Reconnected;
|
||||
reconnect();
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" reconnected").toString());
|
||||
logger.info(new StringBuilder("User ").append(userName).append(" reconnected - userId = ").append(userId.toString()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue