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

47 lines
1.1 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)
public void onePerkLeap(PerkLeapEvent event)
{
_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()))
getGame().AddStat(winner, "Paralympics", 1, true, false);
}
}
}
}