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

36 lines
871 B
Java
Raw Normal View History

2014-08-22 00:55:40 +02:00
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
2014-08-25 22:27:02 +02:00
import nautilus.game.arcade.game.Game;
2014-08-22 00:55:40 +02:00
import nautilus.game.arcade.game.games.turfforts.TurfForts;
public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
{
public BehindEnemyLinesStatTracker(TurfForts game)
{
super(game);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
2014-08-25 22:27:02 +02:00
if (getGame().GetState() != Game.GameState.Live)
return;
2014-08-22 00:55:40 +02:00
if (event.getType() == UpdateType.SEC)
{
for (Player player : getGame().GetPlayers(true))
{
Long time = getGame().getEnemyTurfEntranceTime(player);
if (time != null && System.currentTimeMillis() - time >= 15000)
addStat(player, "BehindEnemyLines", 1, true, false);
2014-08-22 00:55:40 +02:00
}
}
}
}