2014-08-18 22:41:16 +02:00
|
|
|
package nautilus.game.arcade.stats;
|
|
|
|
|
2014-08-25 22:27:02 +02:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
|
|
|
|
import mineplex.core.common.util.UtilPlayer;
|
|
|
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
|
|
|
import nautilus.game.arcade.game.Game;
|
2014-08-18 22:41:16 +02:00
|
|
|
|
|
|
|
public class DeathsStatTracker extends StatTracker<Game>
|
|
|
|
{
|
|
|
|
public DeathsStatTracker(Game game)
|
|
|
|
{
|
|
|
|
super(game);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
|
|
|
public void onCombatDeath(CombatDeathEvent event)
|
|
|
|
{
|
2014-08-25 22:27:02 +02:00
|
|
|
if (getGame().GetState() != Game.GameState.Live)
|
|
|
|
return;
|
|
|
|
|
2014-08-18 22:41:16 +02:00
|
|
|
if (event.GetLog().GetPlayer() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!event.GetLog().GetPlayer().IsPlayer())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
|
|
|
if (player == null)
|
|
|
|
return;
|
|
|
|
|
2014-08-26 22:30:55 +02:00
|
|
|
addStat(player, "Deaths", 1, false, false);
|
2014-08-25 22:27:02 +02:00
|
|
|
|
2015-01-29 01:54:59 +01:00
|
|
|
// if (getGame().GetKit(player) != null)
|
|
|
|
// addStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
|
2014-08-18 22:41:16 +02:00
|
|
|
}
|
|
|
|
}
|