Changes to user / tournament / match handling.

This commit is contained in:
LevelX2 2014-09-18 23:50:34 +02:00
parent ffa959d536
commit eeb22c05ee
11 changed files with 55 additions and 50 deletions

View file

@ -56,7 +56,7 @@ public interface Match {
MatchPlayer getPlayer(UUID playerId);
void addPlayer(Player player, Deck deck);
boolean leave(UUID playerId);
boolean quitMatch(UUID playerId);
void submitDeck(UUID playerId, Deck deck);
void updateDeck(UUID playerId, Deck deck);

View file

@ -93,7 +93,7 @@ public abstract class MatchImpl implements Match {
}
@Override
public boolean leave(UUID playerId) {
public boolean quitMatch(UUID playerId) {
MatchPlayer mPlayer = getPlayer(playerId);
if (mPlayer != null) {
if (!hasStarted()) {

View file

@ -76,7 +76,7 @@ public class TournamentPairing {
* Called by eliminate tournaments after each match
*/
public void eliminatePlayers() {
if (match.hasEnded()) {
if (match != null && match.hasEnded()) {
MatchPlayer mPlayer1 = match.getPlayer(player1.getPlayer().getId());
MatchPlayer mPlayer2 = match.getPlayer(player2.getPlayer().getId());
if (mPlayer1.hasQuit() || !mPlayer1.isMatchWinner()) {
@ -88,7 +88,7 @@ public class TournamentPairing {
}
}
public void finishPlayersThatPlayedLastRound() {
if (match.hasEnded()) {
if (match != null && match.hasEnded()) {
if (!player1.isEliminated()) {
player1.setEliminated();
player1.setState(TournamentPlayerState.FINISHED);