46 lines
932 B
Java
46 lines
932 B
Java
|
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;
|
||
|
}
|
||
|
}
|