mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
* Table handling - Fixed that it was possible to join a table multiple times with the same user.
This commit is contained in:
parent
737768bff9
commit
3ee609d98b
1 changed files with 9 additions and 5 deletions
|
@ -155,13 +155,17 @@ public class TableController {
|
|||
if (seat == null) {
|
||||
throw new GameException("No available seats.");
|
||||
}
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user == null) {
|
||||
logger.fatal(new StringBuilder("couldn't get user ").append(name).append(" for join tornament userId = ").append(userId).toString());
|
||||
return false;
|
||||
}
|
||||
if (userPlayerMap.containsKey(userId)){
|
||||
user.showUserMessage("Join Table", new StringBuilder("You can join a table only one time.").toString());
|
||||
return false;
|
||||
}
|
||||
Player player = createPlayer(name, seat.getPlayerType(), skill);
|
||||
if (player != null) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user == null) {
|
||||
logger.fatal(new StringBuilder("couldn't get user ").append(name).append(" for join tornament userId = ").append(userId).toString());
|
||||
return false;
|
||||
}
|
||||
if (!player.canJoinTable(table)) {
|
||||
user.showUserMessage("Join Table", new StringBuilder("A ").append(seat.getPlayerType()).append(" player can't join this table.").toString());
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue