Started fixing that match does not end, if player left mage during sideboarding (not finished yet).

This commit is contained in:
LevelX2 2013-07-23 17:23:47 +02:00
parent 94109b5e2e
commit 1016decf07
2 changed files with 12 additions and 4 deletions

View file

@ -186,9 +186,13 @@ public class Table implements Serializable {
for (int i = 0; i < numSeats; i++ ) {
Player player = seats[i].getPlayer();
if (player != null && player.getId().equals(playerId)) {
seats[i].setPlayer(null);
if (state == TableState.STARTING) {
state = TableState.WAITING;
if (match != null) {
match.leave(playerId);
} else {
seats[i].setPlayer(null);
if (state == TableState.STARTING) {
state = TableState.WAITING;
}
}
break;
}

View file

@ -90,7 +90,11 @@ public abstract class MatchImpl implements Match {
public boolean leave(UUID playerId) {
MatchPlayer mPlayer = getPlayer(playerId);
if (mPlayer != null) {
return players.remove(mPlayer);
boolean result = players.remove(mPlayer);
synchronized (this) {
this.notifyAll();
}
return result;
}
return false;
}