mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Fixed a bug that players were not removed properly from matches or tournaments they left before the match or tournament was started.
This commit is contained in:
parent
1df4946135
commit
a070c5a8e1
4 changed files with 27 additions and 2 deletions
|
|
@ -281,7 +281,18 @@ public class TableController {
|
|||
|
||||
public synchronized void leaveTable(UUID userId) {
|
||||
if (table.getState() == TableState.WAITING || table.getState() == TableState.STARTING) {
|
||||
table.leaveTable(userPlayerMap.get(userId));
|
||||
UUID playerId = userPlayerMap.get(userId);
|
||||
if (playerId != null) {
|
||||
table.leaveTable(playerId);
|
||||
if (table.isTournament()) {
|
||||
tournament.leave(playerId);
|
||||
} else {
|
||||
match.leave(playerId);
|
||||
}
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
user.removeTable(playerId);
|
||||
userPlayerMap.remove(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue