Fixed wins..

This commit is contained in:
Mysticate 2015-08-29 00:58:53 -06:00
parent b71bcfab4b
commit 12d9888a1f
4 changed files with 45 additions and 24 deletions

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.evolution;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -92,9 +93,7 @@ public class Evolution extends SoloGame
private ArrayList<Player> _evolutionsAvailable = new ArrayList<Player>();
private NautHashMap<String, Float> _chargingExp = new NautHashMap<String, Float>();
public Player Winner = null;
@SuppressWarnings("unchecked")
public Evolution(ArcadeManager manager)
{
@ -749,9 +748,6 @@ public class Evolution extends SoloGame
if (player.isOnline())
AddGems(player, 10, "Participation", false, false);
if (players.size() >= 1)
Winner = players.get(0);
_tokens.clear();
_evoPlatforms.clear();
_evolutionsAvailable.clear();
@ -762,6 +758,21 @@ public class Evolution extends SoloGame
AnnounceEnd(players);
}
@Override
public List<Player> getWinners()
{
if (GetState() != GameState.End)
return null;
ArrayList<EvoToken> tokens = new ArrayList<EvoToken>(_tokens.values());
Collections.sort(tokens);
if (tokens.size() < 1)
return null;
return Arrays.asList(tokens.get(0).Player);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)

View File

@ -49,12 +49,15 @@ public class EvoWinWithoutDyingTracker extends StatTracker<Evolution>
if (event.GetState() != GameState.End)
return;
if (getGame().Winner == null)
if (getGame().getWinners() == null)
return;
if (_out.contains(getGame().Winner.getName()))
return;
addStat(getGame().Winner, "NoDeaths", 1, true, false);
for (Player player : getGame().getWinners())
{
if (_out.contains(player.getName()))
continue;
addStat(player, "NoDeaths", 1, true, false);
}
}
}

View File

@ -8,6 +8,7 @@ import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -43,12 +44,15 @@ public class NoAbilityTracker extends StatTracker<Evolution>
if (event.GetState() != GameState.End)
return;
if (getGame().Winner == null)
if (getGame().getWinners() == null)
return;
if (_out.contains(getGame().Winner.getName()))
return;
addStat(getGame().Winner, "MeleeOnly", 1, true, false);
for (Player player : getGame().getWinners())
{
if (_out.contains(player.getName()))
continue;
addStat(player, "MeleeOnly", 1, true, false);
}
}
}

View File

@ -50,13 +50,16 @@ public class NoMeleeTracker extends StatTracker<Evolution>
{
if (event.GetState() != GameState.End)
return;
if (getGame().Winner == null)
if (getGame().getWinners() == null)
return;
if (_out.contains(getGame().Winner.getName()))
return;
addStat(getGame().Winner, "AbilityOnly", 1, true, false);
for (Player player : getGame().getWinners())
{
if (_out.contains(player.getName()))
continue;
addStat(player, "AbilityOnly", 1, true, false);
}
}
}