From 933d32d8f804a01b9c82c6f9869435097358338d Mon Sep 17 00:00:00 2001 From: CoderTim Date: Mon, 25 Aug 2014 18:06:50 -0400 Subject: [PATCH] Fixed team death/kills stats --- .../src/nautilus/game/arcade/game/Game.java | 6 +++++- .../src/nautilus/game/arcade/game/TeamGame.java | 9 ++------- ...DeathsStatTracker.java => TeamDeathsStatTracker.java} | 8 +++++--- ...meKillsStatTracker.java => TeamKillsStatTracker.java} | 8 +++++--- 4 files changed, 17 insertions(+), 14 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/{TeamGameDeathsStatTracker.java => TeamDeathsStatTracker.java} (85%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/{TeamGameKillsStatTracker.java => TeamKillsStatTracker.java} (85%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 92257bfee..d77a2b868 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -25,6 +25,8 @@ import nautilus.game.arcade.stats.DeathsStatTracker; import nautilus.game.arcade.stats.KillsStatTracker; import nautilus.game.arcade.stats.LoseStatTracker; 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.world.WorldData; @@ -250,7 +252,9 @@ public abstract class Game implements Listener new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker(this), - new DamageTakenStatTracker(this) + new DamageTakenStatTracker(this), + new TeamDeathsStatTracker(this), + new TeamKillsStatTracker(this) ); System.out.println("Loading " + GetName() + "..."); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 94739b377..111f450b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -8,8 +8,8 @@ import nautilus.game.arcade.*; import nautilus.game.arcade.events.*; import nautilus.game.arcade.game.GameTeam.*; import nautilus.game.arcade.kit.*; -import nautilus.game.arcade.stats.TeamGameDeathsStatTracker; -import nautilus.game.arcade.stats.TeamGameKillsStatTracker; +import nautilus.game.arcade.stats.TeamDeathsStatTracker; +import nautilus.game.arcade.stats.TeamKillsStatTracker; import org.bukkit.entity.*; import org.bukkit.event.*; @@ -30,11 +30,6 @@ public abstract class TeamGame extends Game public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { super(manager, gameType, kits, gameDesc); - - registerStatTrackers( - new TeamGameDeathsStatTracker(this), - new TeamGameKillsStatTracker(this) - ); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameDeathsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java similarity index 85% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameDeathsStatTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java index 634853ca7..2d787c8f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameDeathsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java @@ -8,11 +8,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -public class TeamGameDeathsStatTracker extends StatTracker +public class TeamDeathsStatTracker extends StatTracker { - public TeamGameDeathsStatTracker(TeamGame game) + public TeamDeathsStatTracker(Game game) { super(game); } @@ -23,6 +22,9 @@ public class TeamGameDeathsStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; + if (getGame().GetTeamList().size() < 2) + return; + if (event.GetLog().GetPlayer() == null) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameKillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java similarity index 85% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameKillsStatTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java index 00dee397f..f723246f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamGameKillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java @@ -8,11 +8,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -public class TeamGameKillsStatTracker extends StatTracker +public class TeamKillsStatTracker extends StatTracker { - public TeamGameKillsStatTracker(TeamGame game) + public TeamKillsStatTracker(Game game) { super(game); } @@ -23,6 +22,9 @@ public class TeamGameKillsStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; + if (getGame().GetTeamList().size() < 2) + return; + if (event.GetLog().GetKiller() == null) return;