2014-08-22 00:55:40 +02:00
|
|
|
package nautilus.game.arcade.stats;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
|
|
|
|
import nautilus.game.arcade.game.Game;
|
|
|
|
import nautilus.game.arcade.game.games.snake.Snake;
|
|
|
|
|
|
|
|
public class SlimySheepStatTracker extends StatTracker<Game>
|
|
|
|
{
|
|
|
|
private final Map<UUID, Integer> _count = new HashMap<>();
|
|
|
|
|
|
|
|
public SlimySheepStatTracker(Game game)
|
|
|
|
{
|
|
|
|
super(game);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
|
|
|
public void onTailCollision(Snake.SlimeUpgradeEvent event)
|
|
|
|
{
|
2014-08-25 22:27:02 +02:00
|
|
|
if (getGame().GetState() != Game.GameState.Live)
|
|
|
|
return;
|
|
|
|
|
2014-08-22 00:55:40 +02:00
|
|
|
Integer count = _count.get(event.getPlayer().getUniqueId());
|
|
|
|
|
|
|
|
count = (count == null ? 0 : count) + 1;
|
|
|
|
|
|
|
|
_count.put(event.getPlayer().getUniqueId(), count);
|
|
|
|
|
|
|
|
if (count >= 20)
|
2014-08-26 22:30:55 +02:00
|
|
|
addStat(event.getPlayer(), "SlimySheep", 1, true, false);
|
2014-08-22 00:55:40 +02:00
|
|
|
}
|
|
|
|
}
|