mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20: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
|
|
@ -50,7 +50,10 @@ public interface Match {
|
|||
boolean isMatchOver();
|
||||
List<MatchPlayer> getPlayers();
|
||||
MatchPlayer getPlayer(UUID playerId);
|
||||
|
||||
void addPlayer(Player player, Deck deck);
|
||||
boolean leave(UUID playerId);
|
||||
|
||||
void submitDeck(UUID playerId, Deck deck);
|
||||
void updateDeck(UUID playerId, Deck deck);
|
||||
void startMatch() throws GameException;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,15 @@ public abstract class MatchImpl implements Match {
|
|||
players.add(mPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leave(UUID playerId) {
|
||||
MatchPlayer mPlayer = getPlayer(playerId);
|
||||
if (mPlayer != null) {
|
||||
return players.remove(mPlayer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startMatch() throws GameException {
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ public abstract class TournamentImpl implements Tournament {
|
|||
|
||||
@Override
|
||||
public void leave(UUID playerId) {
|
||||
//TODO: implement this
|
||||
if (players.containsKey(playerId)) {
|
||||
players.remove(playerId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue