mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Started fixing that match does not end, if player left mage during sideboarding (not finished yet).
This commit is contained in:
parent
94109b5e2e
commit
1016decf07
2 changed files with 12 additions and 4 deletions
|
@ -186,9 +186,13 @@ public class Table implements Serializable {
|
||||||
for (int i = 0; i < numSeats; i++ ) {
|
for (int i = 0; i < numSeats; i++ ) {
|
||||||
Player player = seats[i].getPlayer();
|
Player player = seats[i].getPlayer();
|
||||||
if (player != null && player.getId().equals(playerId)) {
|
if (player != null && player.getId().equals(playerId)) {
|
||||||
seats[i].setPlayer(null);
|
if (match != null) {
|
||||||
if (state == TableState.STARTING) {
|
match.leave(playerId);
|
||||||
state = TableState.WAITING;
|
} else {
|
||||||
|
seats[i].setPlayer(null);
|
||||||
|
if (state == TableState.STARTING) {
|
||||||
|
state = TableState.WAITING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,11 @@ public abstract class MatchImpl implements Match {
|
||||||
public boolean leave(UUID playerId) {
|
public boolean leave(UUID playerId) {
|
||||||
MatchPlayer mPlayer = getPlayer(playerId);
|
MatchPlayer mPlayer = getPlayer(playerId);
|
||||||
if (mPlayer != null) {
|
if (mPlayer != null) {
|
||||||
return players.remove(mPlayer);
|
boolean result = players.remove(mPlayer);
|
||||||
|
synchronized (this) {
|
||||||
|
this.notifyAll();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue