Fixed team death/kills stats

This commit is contained in:
CoderTim 2014-08-25 18:06:50 -04:00
parent 9acc7d8496
commit 933d32d8f8
4 changed files with 17 additions and 14 deletions

View File

@ -25,6 +25,8 @@ import nautilus.game.arcade.stats.DeathsStatTracker;
import nautilus.game.arcade.stats.KillsStatTracker; import nautilus.game.arcade.stats.KillsStatTracker;
import nautilus.game.arcade.stats.LoseStatTracker; import nautilus.game.arcade.stats.LoseStatTracker;
import nautilus.game.arcade.stats.StatTracker; import nautilus.game.arcade.stats.StatTracker;
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
import nautilus.game.arcade.stats.TeamKillsStatTracker;
import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.stats.WinStatTracker;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
@ -250,7 +252,9 @@ public abstract class Game implements Listener
new WinStatTracker(this), new WinStatTracker(this),
new LoseStatTracker(this), new LoseStatTracker(this),
new DamageDealtStatTracker(this), new DamageDealtStatTracker(this),
new DamageTakenStatTracker(this) new DamageTakenStatTracker(this),
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
); );
System.out.println("Loading " + GetName() + "..."); System.out.println("Loading " + GetName() + "...");

View File

@ -8,8 +8,8 @@ import nautilus.game.arcade.*;
import nautilus.game.arcade.events.*; import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.GameTeam.*; import nautilus.game.arcade.game.GameTeam.*;
import nautilus.game.arcade.kit.*; import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.stats.TeamGameDeathsStatTracker; import nautilus.game.arcade.stats.TeamDeathsStatTracker;
import nautilus.game.arcade.stats.TeamGameKillsStatTracker; import nautilus.game.arcade.stats.TeamKillsStatTracker;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.*; import org.bukkit.event.*;
@ -30,11 +30,6 @@ public abstract class TeamGame extends Game
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{ {
super(manager, gameType, kits, gameDesc); super(manager, gameType, kits, gameDesc);
registerStatTrackers(
new TeamGameDeathsStatTracker(this),
new TeamGameKillsStatTracker(this)
);
} }
@EventHandler @EventHandler

View File

@ -8,11 +8,10 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
public class TeamGameDeathsStatTracker extends StatTracker<TeamGame> public class TeamDeathsStatTracker extends StatTracker<Game>
{ {
public TeamGameDeathsStatTracker(TeamGame game) public TeamDeathsStatTracker(Game game)
{ {
super(game); super(game);
} }
@ -23,6 +22,9 @@ public class TeamGameDeathsStatTracker extends StatTracker<TeamGame>
if (getGame().GetState() != Game.GameState.Live) if (getGame().GetState() != Game.GameState.Live)
return; return;
if (getGame().GetTeamList().size() < 2)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;

View File

@ -8,11 +8,10 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
public class TeamGameKillsStatTracker extends StatTracker<TeamGame> public class TeamKillsStatTracker extends StatTracker<Game>
{ {
public TeamGameKillsStatTracker(TeamGame game) public TeamKillsStatTracker(Game game)
{ {
super(game); super(game);
} }
@ -23,6 +22,9 @@ public class TeamGameKillsStatTracker extends StatTracker<TeamGame>
if (getGame().GetState() != Game.GameState.Live) if (getGame().GetState() != Game.GameState.Live)
return; return;
if (getGame().GetTeamList().size() < 2)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;