Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

Conflicts:
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java
This commit is contained in:
Chiss 2014-08-26 08:19:50 +10:00
commit 86930de23e
54 changed files with 321 additions and 50 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,6 +8,9 @@ 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.TeamDeathsStatTracker;
import nautilus.game.arcade.stats.TeamKillsStatTracker;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.*; import org.bukkit.event.*;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;

View File

@ -1,11 +1,13 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.*; import org.bukkit.event.EventHandler;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*; import mineplex.core.common.util.UtilPlayer;
import org.bukkit.event.*; import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class AssistsStatTracker extends StatTracker<Game> public class AssistsStatTracker extends StatTracker<Game>
{ {
@ -17,19 +19,23 @@ public class AssistsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
for (CombatComponent log : event.GetLog().GetAttackers()) for (CombatComponent log : event.GetLog().GetAttackers())
{ {
if (!log.IsPlayer())
continue;
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
continue; continue;
Player player = UtilPlayer.searchExact(log.GetName()); Player player = UtilPlayer.searchExact(log.GetName());
if (player != null)
{
getGame().AddStat(player, "Assists", 1, false, false); getGame().AddStat(player, "Assists", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
}
} }
} }
} }

View File

@ -27,6 +27,9 @@ public class BackstabKillStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;
@ -59,6 +62,9 @@ public class BackstabKillStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null) if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null)
{ {
Set<UUID> hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId()); Set<UUID> hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId());

View File

@ -26,6 +26,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChangeForm(HideSeek.ChangeFormEvent event) public void onChangeForm(HideSeek.ChangeFormEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getForm() instanceof CreatureForm) if (event.getForm() instanceof CreatureForm)
_disqualified.add(event.getPlayer().getUniqueId()); _disqualified.add(event.getPlayer().getUniqueId());
} }
@ -33,6 +36,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event) public void onPlayerDeath(PlayerDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_disqualified.add(event.getEntity().getUniqueId()); _disqualified.add(event.getEntity().getUniqueId());
} }

View File

@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.turfforts.TurfForts;
public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts> public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
@ -17,6 +18,9 @@ public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.SEC) if (event.getType() == UpdateType.SEC)
{ {
for (Player player : getGame().GetPlayers(true)) for (Player player : getGame().GetPlayers(true))

View File

@ -18,6 +18,9 @@ public class BlockShreadStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onShredBlock(TurfForts.ShredBlockEvent event) public void onShredBlock(TurfForts.ShredBlockEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getArrow().getShooter() instanceof Player) if (event.getArrow().getShooter() instanceof Player)
{ {
Player shooter = (Player) event.getArrow().getShooter(); Player shooter = (Player) event.getArrow().getShooter();

View File

@ -26,6 +26,9 @@ public class BloodThirstyStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*; import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.bridge.*; import nautilus.game.arcade.game.games.bridge.*;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.*; import org.bukkit.event.*;
@ -17,6 +18,9 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (getGame().isBridgesDown()) if (getGame().isBridgesDown())
return; return;

View File

@ -22,6 +22,9 @@ public class CannibalStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.TailCollisionEvent event) public void onTailCollision(Snake.TailCollisionEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer killCount = _kills.get(event.getKiller().getUniqueId()); Integer killCount = _kills.get(event.getKiller().getUniqueId());
killCount = (killCount == null ? 0 : killCount) + 1; killCount = (killCount == null ? 0 : killCount) + 1;

View File

@ -16,6 +16,9 @@ public class ChooChooStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailGrow(Snake.TailGrowEvent event) public void onTailGrow(Snake.TailGrowEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getLength() >= 60) if (event.getLength() >= 60)
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false); getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
} }

View File

@ -25,6 +25,9 @@ public class ComeAtMeBroStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -15,13 +15,16 @@ public class DamageDealtStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damager = event.GetDamagerPlayer(false); Player damager = event.GetDamagerPlayer(false);
if (damager == null) if (damager == null)
return; return;
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
if (getGame() != null && getGame().GetKit(damager) != null) if (getGame().GetKit(damager) != null)
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
} }
} }

View File

@ -15,13 +15,16 @@ public class DamageTakenStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) if (damagee == null)
return; return;
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
if (getGame() != null && getGame().GetKit(damagee) != null) if (getGame().GetKit(damagee) != null)
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
} }
} }

View File

@ -25,6 +25,9 @@ public class DeathBomberStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,10 +1,12 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.*; import org.bukkit.event.EventPriority;
import org.bukkit.entity.*;
import org.bukkit.event.*; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class DeathsStatTracker extends StatTracker<Game> public class DeathsStatTracker extends StatTracker<Game>
{ {
@ -16,6 +18,9 @@ public class DeathsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;
@ -27,6 +32,8 @@ public class DeathsStatTracker extends StatTracker<Game>
return; return;
getGame().AddStat(player, "Deaths", 1, false, false); getGame().AddStat(player, "Deaths", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false); getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
} }
} }

View File

@ -14,6 +14,9 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLightningOrb(LightningOrb.LightningOrbEvent event) public void onLightningOrb(LightningOrb.LightningOrbEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getStruck().size() >= 4) if (event.getStruck().size() >= 4)
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false); getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
} }

View File

@ -33,6 +33,9 @@ public class FastKillsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -16,6 +16,9 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSupplyChestOpen(SupplyChestOpenEvent event) public void onSupplyChestOpen(SupplyChestOpenEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (first) if (first)
{ {
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false); getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);

View File

@ -18,6 +18,9 @@ public class FoodForTheMassesStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeathEvent(CombatDeathEvent event) public void onCombatDeathEvent(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -27,6 +27,8 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
if (winners != null) if (winners != null)
{ {
for (Player winner : winners) for (Player winner : winners)
{
if (getGame().GetKit(winner) != null)
{ {
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free) if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
getGame().AddStat(winner, "FreeKitsForever", 1, false, false); getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
@ -35,3 +37,4 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
} }
} }
} }
}

View File

@ -25,6 +25,9 @@ public class HunterKillerStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -26,6 +26,9 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -25,6 +25,9 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
@EventHandler @EventHandler
public void onDrawRoundEnd(DrawRoundEndEvent event) public void onDrawRoundEnd(DrawRoundEndEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); ) for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); )
{ {
Player player = it.next(); Player player = it.next();

View File

@ -21,6 +21,9 @@ public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,10 +1,12 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.*; import org.bukkit.event.EventPriority;
import org.bukkit.entity.*;
import org.bukkit.event.*; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class KillsStatTracker extends StatTracker<Game> public class KillsStatTracker extends StatTracker<Game>
{ {
@ -16,6 +18,9 @@ public class KillsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;
@ -27,6 +32,8 @@ public class KillsStatTracker extends StatTracker<Game>
return; return;
getGame().AddStat(player, "Kills", 1, false, false); getGame().AddStat(player, "Kills", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false); getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
} }
} }

View File

@ -38,6 +38,9 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -25,6 +25,9 @@ public class KingDamageStatTracker extends StatTracker<CastleSiege>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onKingDamage(CastleSiege.KingDamageEvent event) public void onKingDamage(CastleSiege.KingDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_totalKingDamage += event.getDamage(); _totalKingDamage += event.getDamage();
Double damage = _kingDamage.get(event.getPlayer().getUniqueId()); Double damage = _kingDamage.get(event.getPlayer().getUniqueId());

View File

@ -15,6 +15,9 @@ public class KingSlayerStatTracker extends StatTracker<Game>
@EventHandler @EventHandler
public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event) public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false); getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
} }
} }

View File

@ -10,6 +10,7 @@ import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer; 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.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead; import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
@ -25,6 +26,9 @@ public class LastStandStatTracker extends StatTracker<TeamGame>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,11 +1,13 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*; import java.util.List;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class LoseStatTracker extends StatTracker<Game> public class LoseStatTracker extends StatTracker<Game>
{ {
@ -26,6 +28,8 @@ public class LoseStatTracker extends StatTracker<Game>
for (Player loser : losers) for (Player loser : losers)
{ {
getGame().AddStat(loser, "Losses", 1, false, false); getGame().AddStat(loser, "Losses", 1, false, false);
if (getGame().GetKit(loser) != null)
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false); getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
} }
} }

View File

@ -16,6 +16,9 @@ public class MedicStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(Paintball.ReviveEvent event) public void onCombatDeath(Paintball.ReviveEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false); getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
} }
} }

View File

@ -22,6 +22,9 @@ public class MeowStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMeow(HideSeek.MeowEvent event) public void onMeow(HideSeek.MeowEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer meows = _meowCount.get(event.getPlayer().getUniqueId()); Integer meows = _meowCount.get(event.getPlayer().getUniqueId());
meows = (meows == null ? 0 : meows) + 1; meows = (meows == null ? 0 : meows) + 1;

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent; import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
@ -25,6 +26,9 @@ public class MrSquiggleStatTracker extends StatTracker<Draw>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event) public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getRank() != 1) if (event.getRank() != 1)
return; return;

View File

@ -26,6 +26,9 @@ public class OneVThreeStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -25,6 +25,9 @@ public class ParalympicsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onePerkLeap(PerkLeapEvent event) public void onePerkLeap(PerkLeapEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_hasLeaped.add(event.GetPlayer().getUniqueId()); _hasLeaped.add(event.GetPlayer().getUniqueId());
} }

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent; import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
@ -16,6 +17,9 @@ public class PureLuckStatTracker extends StatTracker<Draw>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event) public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000) if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false); getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
} }

View File

@ -25,6 +25,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;
@ -41,6 +44,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) if (damagee == null)
return; return;

View File

@ -14,6 +14,9 @@ public class SeismicSlamStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLongshotHit(SeismicSlam.SeismicSlamEvent event) public void onLongshotHit(SeismicSlam.SeismicSlamEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getTargets().size() >= 5) if (event.getTargets().size() >= 5)
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false); getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
} }

View File

@ -27,7 +27,10 @@ public class SharpShooterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onProjectileLaunch(ProjectileLaunchEvent event) public void onProjectileLaunch(ProjectileLaunchEvent event)
{ {
if (event.getEntity().getShooter() instanceof Player) if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getEntity().getShooter() instanceof Player && event.getEntity() instanceof Arrow)
{ {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
@ -40,6 +43,9 @@ public class SharpShooterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onArrowHit(CustomDamageEvent event) public void onArrowHit(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null) if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null)
{ {
if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer()) if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer())

View File

@ -16,6 +16,9 @@ public class SheepDropStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.DropEnemySheepEvent event) public void onSheepStolen(SheepGame.DropEnemySheepEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false); getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
} }
} }

View File

@ -16,6 +16,9 @@ public class SheepThiefStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.SheepStolenEvent event) public void onSheepStolen(SheepGame.SheepStolenEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false); getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
} }
} }

View File

@ -21,6 +21,9 @@ public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
@EventHandler @EventHandler
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event) public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer()); List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
if (skeletons != null) if (skeletons != null)

View File

@ -22,6 +22,9 @@ public class SlimySheepStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.SlimeUpgradeEvent event) public void onTailCollision(Snake.SlimeUpgradeEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer count = _count.get(event.getPlayer().getUniqueId()); Integer count = _count.get(event.getPlayer().getUniqueId());
count = (count == null ? 0 : count) + 1; count = (count == null ? 0 : count) + 1;

View File

@ -16,6 +16,9 @@ public class SparklezStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onThrowSparkler(PerkSparkler.ThrowSparklerEvent event) public void onThrowSparkler(PerkSparkler.ThrowSparklerEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false); getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false);
} }
} }

View File

@ -14,8 +14,11 @@ public class SpleefBlockDestroyStatTracker extends StatTracker<Game>
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onThrowSparkler(SpleefDestroyBlockEvent event) public void onSpleefDestroyBlock(SpleefDestroyBlockEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "SpleefBlocks", 1, false, false); getGame().AddStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
} }
} }

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;
import nautilus.game.arcade.game.GameTeam;
public class TeamDeathsStatTracker extends StatTracker<Game>
{
public TeamDeathsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (getGame().GetTeamList().size() < 2)
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;
GameTeam team = getGame().GetTeam(player);
if (team != null && team.GetName() != null)
getGame().AddStat(player, team.GetName() + " Deaths", 1, false, false);
}
}

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;
import nautilus.game.arcade.game.GameTeam;
public class TeamKillsStatTracker extends StatTracker<Game>
{
public TeamKillsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (getGame().GetTeamList().size() < 2)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
GameTeam team = getGame().GetTeam(player);
if (team != null && team.GetName() != null)
getGame().AddStat(player, team.GetName() + " Kills", 1, false, false);
}
}

View File

@ -26,9 +26,10 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.TICK) if (event.getType() == UpdateType.TICK)
{
if (getGame().GetState() == Game.GameState.Live)
{ {
for (GameTeam team : getGame().GetTeamList()) for (GameTeam team : getGame().GetTeamList())
{ {
@ -37,7 +38,6 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
} }
} }
} }
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event) public void onGameStateChange(GameStateChangeEvent event)

View File

@ -20,6 +20,9 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -14,6 +14,9 @@ public class TntMinerStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityExplode(PerkBomber.BomberExplodeDiamondBlock event) public void onEntityExplode(PerkBomber.BomberExplodeDiamondBlock event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false); getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
} }
} }

View File

@ -1,11 +1,13 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*; import java.util.List;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class WinStatTracker extends StatTracker<Game> public class WinStatTracker extends StatTracker<Game>
{ {
@ -26,6 +28,8 @@ public class WinStatTracker extends StatTracker<Game>
for (Player winner : winners) for (Player winner : winners)
{ {
getGame().AddStat(winner, "Wins", 1, false, false); getGame().AddStat(winner, "Wins", 1, false, false);
if (getGame().GetKit(winner) != null)
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false); getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
} }
} }

View File

@ -22,12 +22,16 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
public WinWithoutDyingStatTracker(Game game, String stat) public WinWithoutDyingStatTracker(Game game, String stat)
{ {
super(game); super(game);
_stat = stat; _stat = stat;
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;

View File

@ -23,7 +23,10 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (event.getType() == UpdateType.FAST && getGame().GetState() == Game.GameState.Live) if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.FAST)
{ {
for (Player player : getGame().GetPlayers(true)) for (Player player : getGame().GetPlayers(true))
{ {