forked from External/mage
Added check to limit the number of waiting tables a player can create at the same time.
This commit is contained in:
parent
04c8351712
commit
fa5dd387b4
4 changed files with 124 additions and 45 deletions
|
|
@ -900,6 +900,22 @@ public class TableController {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean isUserStillActive(UUID userId) {
|
||||
UUID playerId = userPlayerMap.get(userId);
|
||||
if (playerId != null) {
|
||||
if (tournament != null) {
|
||||
TournamentPlayer tournamentPlayer = tournament.getPlayer(playerId);
|
||||
if (tournamentPlayer != null) {
|
||||
return tournamentPlayer.isInTournament();
|
||||
}
|
||||
} else if (match != null) {
|
||||
MatchPlayer matchPlayer = match.getPlayer(playerId);
|
||||
return matchPlayer != null && !matchPlayer.hasQuit();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMatchTableStillValid() {
|
||||
// check only normal match table with state != Finished
|
||||
if (!table.isTournament()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue