mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Fixed a bug that players that left a match before the match was started were not removed correctly from the match.
This commit is contained in:
parent
a21f7f315d
commit
7b349c856f
2 changed files with 6 additions and 7 deletions
|
@ -186,13 +186,9 @@ public class Table implements Serializable {
|
|||
for (int i = 0; i < numSeats; i++ ) {
|
||||
Player player = seats[i].getPlayer();
|
||||
if (player != null && player.getId().equals(playerId)) {
|
||||
if (match != null) {
|
||||
match.leave(playerId);
|
||||
} else {
|
||||
seats[i].setPlayer(null);
|
||||
if (state == TableState.STARTING) {
|
||||
state = TableState.WAITING;
|
||||
}
|
||||
seats[i].setPlayer(null);
|
||||
if (state == TableState.STARTING) {
|
||||
state = TableState.WAITING;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,9 @@ public abstract class MatchImpl implements Match {
|
|||
public boolean leave(UUID playerId) {
|
||||
MatchPlayer mPlayer = getPlayer(playerId);
|
||||
if (mPlayer != null) {
|
||||
if (games.isEmpty() ) {
|
||||
return players.remove(mPlayer);
|
||||
}
|
||||
mPlayer.setQuit(true);
|
||||
synchronized (this) {
|
||||
this.notifyAll();
|
||||
|
|
Loading…
Reference in a new issue