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>
|
|
|
|
{
|
2014-08-22 23:20:02 +02:00
|
|
|
private final String _stat;
|
|
|
|
|
|
|
|
public WinWithoutLosingTeammateStatTracker(TeamGame game, String stat)
|
2014-08-18 22:41:16 +02:00
|
|
|
{
|
|
|
|
super(game);
|
2014-08-22 23:20:02 +02:00
|
|
|
_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))
|
2014-08-26 22:30:55 +02:00
|
|
|
addStat(player, getStat(), 1, true, false);
|
2014-08-18 22:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-22 23:20:02 +02:00
|
|
|
|
|
|
|
public String getStat()
|
|
|
|
{
|
|
|
|
return _stat;
|
|
|
|
}
|
2014-08-18 22:41:16 +02:00
|
|
|
}
|