Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ParalympicsStatTracker.java

50 lines
1.2 KiB
Java
Raw Normal View History

2014-08-22 00:55:40 +02:00
package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
public class ParalympicsStatTracker extends StatTracker<Game>
{
private final Set<UUID> _hasLeaped = new HashSet<>();
public ParalympicsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
2014-08-27 02:27:39 +02:00
public void onPerkLeap(PerkLeapEvent event)
2014-08-22 00:55:40 +02:00
{
2014-08-25 22:27:02 +02:00
if (getGame().GetState() != Game.GameState.Live)
return;
2014-08-22 00:55:40 +02:00
_hasLeaped.add(event.GetPlayer().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
for (Player winner : winners)
{
if (!_hasLeaped.contains(winner.getUniqueId()))
addStat(winner, "Paralympics", 1, true, false);
2014-08-22 00:55:40 +02:00
}
}
}
}