Store winner UUID instead of Player object to avoid leaking excess data

This commit is contained in:
Shaun Bennett 2016-01-20 13:33:40 -05:00
parent cf7f5af9ca
commit 4924d652f5

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@ -144,7 +145,7 @@ public class Build extends SoloGame
private ChatColor _hintColor = ChatColor.YELLOW;
private ChatColor _firstHintColor = ChatColor.YELLOW;
private Player _winner = null;
private UUID _winnerUUID = null;
public Build(ArcadeManager manager)
{
@ -543,7 +544,7 @@ public class Build extends SoloGame
//Gems
if (places.size() >= 1)
{
_winner = places.get(0);
_winnerUUID = places.get(0).getUniqueId();
AddGems(places.get(0), 20, "1st Place", false, false);
}
@ -1553,9 +1554,10 @@ public class Build extends SoloGame
@Override
public List<Player> getWinners()
{
if (_winner == null)
Player player = UtilPlayer.searchExact(_winnerUUID);
if (player == null)
return null;
return Arrays.asList(_winner);
return Arrays.asList(player);
}
}