Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java
2015-10-11 22:43:21 -04:00

42 lines
938 B
Java

package nautilus.game.arcade.stats;
import java.util.List;
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;
public class WinStatTracker extends StatTracker<Game>
{
public WinStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
{
if (!winner.isOnline())
continue;
addStat(winner, "Wins", 1, false, false);
// if (getGame().GetKit(winner) != null)
// addStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
}
}
}
}
}