Fixed some NPEs and achievement bugs
This commit is contained in:
parent
0e3cf67402
commit
4ce537a3a7
@ -1,11 +1,13 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.minecraft.game.core.combat.*;
|
||||
import mineplex.minecraft.game.core.combat.event.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
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.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class AssistsStatTracker extends StatTracker<Game>
|
||||
{
|
||||
@ -17,6 +19,9 @@ public class AssistsStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
for (CombatComponent log : event.GetLog().GetAttackers())
|
||||
{
|
||||
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
|
||||
@ -24,8 +29,13 @@ public class AssistsStatTracker extends StatTracker<Game>
|
||||
|
||||
Player player = UtilPlayer.searchExact(log.GetName());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
getGame().AddStat(player, "Assists", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ public class BackstabKillStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
@ -59,6 +62,9 @@ public class BackstabKillStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null)
|
||||
{
|
||||
Set<UUID> hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId());
|
||||
|
@ -26,6 +26,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChangeForm(HideSeek.ChangeFormEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getForm() instanceof CreatureForm)
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
}
|
||||
@ -33,6 +36,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
_disqualified.add(event.getEntity().getUniqueId());
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
|
||||
public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
|
||||
@ -17,6 +18,9 @@ public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
|
@ -18,6 +18,9 @@ public class BlockShreadStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onShredBlock(TurfForts.ShredBlockEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getArrow().getShooter() instanceof Player)
|
||||
{
|
||||
Player shooter = (Player) event.getArrow().getShooter();
|
||||
|
@ -26,6 +26,9 @@ public class BloodThirstyStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.stats;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.minecraft.game.core.combat.event.*;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.bridge.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
@ -17,6 +18,9 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (getGame().isBridgesDown())
|
||||
return;
|
||||
|
||||
|
@ -22,6 +22,9 @@ public class CannibalStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onTailCollision(Snake.TailCollisionEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Integer killCount = _kills.get(event.getKiller().getUniqueId());
|
||||
|
||||
killCount = (killCount == null ? 0 : killCount) + 1;
|
||||
|
@ -16,6 +16,9 @@ public class ChooChooStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onTailGrow(Snake.TailGrowEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getLength() >= 60)
|
||||
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class ComeAtMeBroStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -15,13 +15,16 @@ public class DamageDealtStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,16 @@ public class DamageTakenStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class DeathBomberStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.minecraft.game.core.combat.event.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
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 DeathsStatTracker extends StatTracker<Game>
|
||||
{
|
||||
@ -16,6 +18,9 @@ public class DeathsStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetPlayer() == null)
|
||||
return;
|
||||
|
||||
@ -27,6 +32,8 @@ public class DeathsStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
getGame().AddStat(player, "Deaths", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onLightningOrb(LightningOrb.LightningOrbEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getStruck().size() >= 4)
|
||||
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
|
||||
}
|
||||
|
@ -33,6 +33,9 @@ public class FastKillsStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -16,6 +16,9 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onSupplyChestOpen(SupplyChestOpenEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (first)
|
||||
{
|
||||
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
|
||||
|
@ -18,6 +18,9 @@ public class FoodForTheMassesStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeathEvent(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -27,6 +27,8 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (getGame().GetKit(winner) != null)
|
||||
{
|
||||
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
|
||||
getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
|
||||
@ -35,3 +37,4 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class HunterKillerStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -26,6 +26,9 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -25,6 +25,9 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
|
||||
@EventHandler
|
||||
public void onDrawRoundEnd(DrawRoundEndEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); )
|
||||
{
|
||||
Player player = it.next();
|
||||
|
@ -21,6 +21,9 @@ public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.minecraft.game.core.combat.event.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
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 KillsStatTracker extends StatTracker<Game>
|
||||
{
|
||||
@ -16,6 +18,9 @@ public class KillsStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
@ -27,6 +32,8 @@ public class KillsStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
getGame().AddStat(player, "Kills", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -25,6 +25,9 @@ public class KingDamageStatTracker extends StatTracker<CastleSiege>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onKingDamage(CastleSiege.KingDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
_totalKingDamage += event.getDamage();
|
||||
|
||||
Double damage = _kingDamage.get(event.getPlayer().getUniqueId());
|
||||
|
@ -15,6 +15,9 @@ public class KingSlayerStatTracker extends StatTracker<Game>
|
||||
@EventHandler
|
||||
public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ 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.TeamGame;
|
||||
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)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import nautilus.game.arcade.events.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
import java.util.List;
|
||||
|
||||
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>
|
||||
{
|
||||
@ -26,6 +28,8 @@ public class LoseStatTracker extends StatTracker<Game>
|
||||
for (Player loser : losers)
|
||||
{
|
||||
getGame().AddStat(loser, "Losses", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(loser) != null)
|
||||
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ public class MedicStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(Paintball.ReviveEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ public class MeowStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onMeow(HideSeek.MeowEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Integer meows = _meowCount.get(event.getPlayer().getUniqueId());
|
||||
|
||||
meows = (meows == null ? 0 : meows) + 1;
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.DrawGuessCorrectlyEvent;
|
||||
|
||||
@ -25,6 +26,9 @@ public class MrSquiggleStatTracker extends StatTracker<Draw>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getRank() != 1)
|
||||
return;
|
||||
|
||||
|
@ -26,6 +26,9 @@ public class OneVThreeStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -25,6 +25,9 @@ public class ParalympicsStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onePerkLeap(PerkLeapEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
_hasLeaped.add(event.GetPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.stats;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.DrawGuessCorrectlyEvent;
|
||||
|
||||
@ -16,6 +17,9 @@ public class PureLuckStatTracker extends StatTracker<Draw>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
|
||||
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetPlayer() == null)
|
||||
return;
|
||||
|
||||
@ -41,6 +44,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null)
|
||||
return;
|
||||
|
@ -14,6 +14,9 @@ public class SeismicSlamStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onLongshotHit(SeismicSlam.SeismicSlamEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getTargets().size() >= 5)
|
||||
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
|
||||
}
|
||||
|
@ -27,7 +27,10 @@ public class SharpShooterStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
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();
|
||||
|
||||
@ -40,6 +43,9 @@ public class SharpShooterStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onArrowHit(CustomDamageEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null)
|
||||
{
|
||||
if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer())
|
||||
|
@ -16,6 +16,9 @@ public class SheepDropStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onSheepStolen(SheepGame.DropEnemySheepEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ public class SheepThiefStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onSheepStolen(SheepGame.SheepStolenEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
|
||||
@EventHandler
|
||||
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
|
||||
|
||||
if (skeletons != null)
|
||||
|
@ -22,6 +22,9 @@ public class SlimySheepStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onTailCollision(Snake.SlimeUpgradeEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Integer count = _count.get(event.getPlayer().getUniqueId());
|
||||
|
||||
count = (count == null ? 0 : count) + 1;
|
||||
|
@ -16,6 +16,9 @@ public class SparklezStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onThrowSparkler(PerkSparkler.ThrowSparklerEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,11 @@ public class SpleefBlockDestroyStatTracker extends StatTracker<Game>
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,10 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
if (getGame().GetState() == Game.GameState.Live)
|
||||
{
|
||||
for (GameTeam team : getGame().GetTeamList())
|
||||
{
|
||||
@ -37,7 +38,6 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
|
@ -20,6 +20,9 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -14,6 +14,9 @@ public class TntMinerStatTracker extends StatTracker<Game>
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onEntityExplode(PerkBomber.BomberExplodeDiamondBlock event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import nautilus.game.arcade.events.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
import java.util.List;
|
||||
|
||||
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>
|
||||
{
|
||||
@ -26,6 +28,8 @@ public class WinStatTracker extends StatTracker<Game>
|
||||
for (Player winner : winners)
|
||||
{
|
||||
getGame().AddStat(winner, "Wins", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(winner) != null)
|
||||
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,16 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
|
||||
public WinWithoutDyingStatTracker(Game game, String stat)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_stat = stat;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetPlayer() == null)
|
||||
return;
|
||||
|
||||
|
@ -23,7 +23,10 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
|
||||
@EventHandler
|
||||
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))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user