Fixed a bug that player names of finished matches were no longer shown in the list of fnished matches.

This commit is contained in:
LevelX2 2013-08-23 14:35:59 +02:00
parent 0c6f3bc463
commit 7cf2b0cc97
2 changed files with 9 additions and 6 deletions

View file

@ -69,9 +69,9 @@ public class MatchView implements Serializable {
for (MatchPlayer player: match.getPlayers()) { for (MatchPlayer player: match.getPlayers()) {
sb1.append(player.getPlayer().getName()).append(", "); sb1.append(player.getPlayer().getName()).append(", ");
sb2.append(player.getPlayer().getName()).append(" ").append(player.getWins()).append("-").append(player.getLoses()).append(", "); sb2.append(player.getPlayer().getName()).append(" ").append(player.getWins()).append("-").append(player.getLoses()).append(", ");
players = sb1.substring(0, sb1.length() - 2);
result = sb2.substring(0, sb2.length() - 2);
} }
players = sb1.substring(0, sb1.length() - 2);
result = sb2.substring(0, sb2.length() - 2);
this.startTime = match.getStartTime(); this.startTime = match.getStartTime();
this.endTime = match.getEndTime(); this.endTime = match.getEndTime();
} }

View file

@ -90,11 +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) {
boolean result = players.remove(mPlayer); mPlayer.setQuit(true);
synchronized (this) { synchronized (this) {
this.notifyAll(); this.notifyAll();
} }
return result; return true;
} }
return false; return false;
} }
@ -302,12 +302,15 @@ public abstract class MatchImpl implements Match {
@Override @Override
public Date getStartTime() { public Date getStartTime() {
return startTime; return new Date(startTime.getTime());
} }
@Override @Override
public Date getEndTime() { public Date getEndTime() {
return endTime; if (endTime != null) {
return new Date(endTime.getTime());
}
return null;
} }
} }