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

34 lines
786 B
Java
Raw Normal View History

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 WinMapStatTracker extends StatTracker<Game>
{
public WinMapStatTracker(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)
getGame().AddStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
}
}
}
}