Little fixes and code refactor

This commit is contained in:
Oleg Agafonov 2020-08-29 18:09:44 +04:00
parent c67e937dfb
commit ab8a4eb26a
8 changed files with 71 additions and 98 deletions

View file

@ -201,7 +201,7 @@ public class MageServerImpl implements MageServer {
// check if user can create another table
int notStartedTables = user.getNumberOfNotStartedTables();
if (notStartedTables > 1) {
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started table" + (notStartedTables == 1 ? "" : "s") + ". You can't create another.");
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started tables. You can't create another.");
throw new MageException("No message");
}
// check AI players max
@ -1102,7 +1102,7 @@ public class MageServerImpl implements MageServer {
execute("removeTable", sessionId, () -> {
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
UUID userId = session.getUserId();
TableManager.instance.removeTable(userId, tableId);
TableManager.instance.removeTable(userId, tableId); // delete account
});
});
}
@ -1327,7 +1327,7 @@ public class MageServerImpl implements MageServer {
// check if user can create another table
int notStartedTables = user.getNumberOfNotStartedTables();
if (notStartedTables > 1) {
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started table" + (notStartedTables == 1 ? "" : "s") + ". You can't create another.");
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started tables. You can't create another.");
throw new MageException("No message");
}
// check if the user itself satisfies the quitRatio requirement.