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

41 lines
917 B
Java
Raw Normal View History

2014-08-18 22:41:16 +02:00
package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
{
private final String _stat;
public WinWithoutLosingTeammateStatTracker(TeamGame game, String stat)
2014-08-18 22:41:16 +02:00
{
super(game);
_stat = stat;
2014-08-18 22:41:16 +02:00
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
GameTeam winner = getGame().WinnerTeam;
2014-08-26 05:42:42 +02:00
if (winner.GetPlayers(false).size() < 4)
return;
2014-08-18 22:41:16 +02:00
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
{
for (Player player : winner.GetPlayers(true))
addStat(player, getStat(), 1, true, false);
2014-08-18 22:41:16 +02:00
}
}
}
public String getStat()
{
return _stat;
}
2014-08-18 22:41:16 +02:00
}