Some stats fixes

This commit is contained in:
CoderTim 2014-08-22 21:54:08 -04:00
parent b2b208bdba
commit 4afafe2d51
6 changed files with 120 additions and 2 deletions

View File

@ -68,7 +68,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.AssistsStatTracker; import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.BloodThirstyStatTracker; import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingDamageStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker; import nautilus.game.arcade.stats.KingSlayerStatTracker;
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
public class CastleSiege extends TeamGame public class CastleSiege extends TeamGame
{ {
@ -190,10 +192,21 @@ public class CastleSiege extends TeamGame
_kingName = C.cYellow + C.Bold + "King Sparklez"; _kingName = C.cYellow + C.Bold + "King Sparklez";
GameTeam notRedTeam = null;
for (GameTeam team : GetTeamList())
{
if (team.GetColor() != ChatColor.RED)
{
notRedTeam = team;
break;
}
}
registerStatTrackers( registerStatTrackers(
new WinAsTeamStatTracker(this, notRedTeam, "ForTheKing"),
new KingSlayerStatTracker(this), new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this), new BloodThirstyStatTracker(this),
new AssistsStatTracker(this) new KingDamageStatTracker(this)
); );
} }

View File

@ -15,6 +15,7 @@ import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -56,6 +57,7 @@ public class ChampionsDominate extends Domination
registerStatTrackers( registerStatTrackers(
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
} }

View File

@ -20,6 +20,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker; import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class ChampionsTDM extends TeamDeathmatch public class ChampionsTDM extends TeamDeathmatch
@ -56,6 +57,7 @@ public class ChampionsTDM extends TeamDeathmatch
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this), new KillAllOpposingStatTracker(this),
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
} }

View File

@ -81,6 +81,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker; import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker; import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
@ -213,6 +214,7 @@ public class HideSeek extends TeamGame
new HunterKillerStatTracker(this), new HunterKillerStatTracker(this),
new MeowStatTracker(this), new MeowStatTracker(this),
new HunterKillerStatTracker(this), new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this),
new BadHiderStatTracker(this) new BadHiderStatTracker(this)
); );
} }

View File

@ -0,0 +1,43 @@
package nautilus.game.arcade.stats;
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;
public class BackstabKillStatTracker extends StatTracker<Game>
{
public BackstabKillStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
if (event.GetLog().GetLastDamager().)
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class TheLongestShotStatTracker extends StatTracker<Game>
{
public TheLongestShotStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
if (edbee.getDamager() instanceof Arrow)
{
Arrow arrow = (Arrow) edbee.getDamager();
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
getGame().AddStat(killer, "TheLongestShot", 1, false, false);
}
}
}
}