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

46 lines
932 B
Java
Raw Normal View History

2014-08-18 22:41:16 +02:00
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
{
private final int _requiredCount;
public SimultaneousSkeletonStatTracker(Game game, int requiredCount)
{
super(game);
_requiredCount = requiredCount;
}
@EventHandler
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
{
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
if (skeletons != null)
{
int aliveCount = 0;
for (Skeleton skeleton : skeletons)
{
if (!skeleton.isDead())
aliveCount++;
}
if (aliveCount >= getRequiredCount())
getGame().AddStat(event.getPlayer(), "Skeletons", 1, true, false);
}
}
public int getRequiredCount()
{
return _requiredCount;
}
}