From 7cf2b0cc97f7b19d95fb5119790987738cc6e957 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 23 Aug 2013 14:35:59 +0200 Subject: [PATCH] Fixed a bug that player names of finished matches were no longer shown in the list of fnished matches. --- Mage.Common/src/mage/view/MatchView.java | 4 ++-- Mage/src/mage/game/match/MatchImpl.java | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Mage.Common/src/mage/view/MatchView.java b/Mage.Common/src/mage/view/MatchView.java index e1240a83e2..d7d31ad2b1 100644 --- a/Mage.Common/src/mage/view/MatchView.java +++ b/Mage.Common/src/mage/view/MatchView.java @@ -69,9 +69,9 @@ public class MatchView implements Serializable { for (MatchPlayer player: match.getPlayers()) { sb1.append(player.getPlayer().getName()).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.endTime = match.getEndTime(); } diff --git a/Mage/src/mage/game/match/MatchImpl.java b/Mage/src/mage/game/match/MatchImpl.java index d44d7ac4b4..fce78e348b 100644 --- a/Mage/src/mage/game/match/MatchImpl.java +++ b/Mage/src/mage/game/match/MatchImpl.java @@ -90,11 +90,11 @@ public abstract class MatchImpl implements Match { public boolean leave(UUID playerId) { MatchPlayer mPlayer = getPlayer(playerId); if (mPlayer != null) { - boolean result = players.remove(mPlayer); + mPlayer.setQuit(true); synchronized (this) { this.notifyAll(); } - return result; + return true; } return false; } @@ -302,12 +302,15 @@ public abstract class MatchImpl implements Match { @Override public Date getStartTime() { - return startTime; + return new Date(startTime.getTime()); } @Override public Date getEndTime() { - return endTime; + if (endTime != null) { + return new Date(endTime.getTime()); + } + return null; } }