add comments, use a more generic map

This commit is contained in:
Spencer 2017-11-25 14:19:10 -05:00 committed by Alexander Meech
parent a3a76bc1f9
commit 8683e8bdc4

View File

@ -1520,11 +1520,13 @@ public abstract class Game extends ListenerComponent implements Lifetimed
{
List<Player> teamList = new ArrayList<>();
List<Player> otherList = new ArrayList<>();
HashMap<Player, Integer> teamGemCount = new HashMap<>();
Map<Player, Integer> teamGemCount = new HashMap<>();
teamList.addAll(team.GetPlacements(true).stream()
.distinct()
.filter((p) -> !getArcadeManager().isVanished(p))
// Get the gem count for each member of the team,
// and save it to the HashMap, so it can be sorted
.peek((p) ->
{
Map<String, GemData> gemDataMap = GetGems(p);
@ -1538,6 +1540,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
teamGemCount.put(p, gemCount);
})
// Sort based on gem count in descending order
.sorted((p1, p2) -> teamGemCount.get(p2) - teamGemCount.get(p1))
.collect(Collectors.toList()));
@ -1547,7 +1550,10 @@ public abstract class Game extends ListenerComponent implements Lifetimed
.filter((p) -> !getArcadeManager().isVanished(p) && !teamList.contains(p))
.collect(Collectors.toList()));
// This sets the "winner" player as the player with the
// most gems, since it's been previously sorted as such
Player player = teamList.remove(0);
WinEffectManager.prePlay(this, player, teamList, otherList);
Location loc = GetSpectatorLocation().clone().add(1000, 0, 1000);