Fixed BadHiderStatTracker and limited stat recording to when games are at least 75% full
This commit is contained in:
parent
232785a7dd
commit
d9e1f35985
@ -111,7 +111,7 @@ public class HideSeek extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
public static class ChangeFormEvent extends PlayerEvent
|
||||
public static class PlayerChangeFormEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@ -128,7 +128,7 @@ public class HideSeek extends TeamGame
|
||||
|
||||
private final Form _form;
|
||||
|
||||
public ChangeFormEvent(Player who, Form form)
|
||||
public PlayerChangeFormEvent(Player who, Form form)
|
||||
{
|
||||
super(who);
|
||||
|
||||
@ -141,6 +141,27 @@ public class HideSeek extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerSolidifyEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public PlayerSolidifyEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
}
|
||||
|
||||
private GameTeam _hiders;
|
||||
private GameTeam _seekers;
|
||||
|
||||
@ -355,7 +376,7 @@ public class HideSeek extends TeamGame
|
||||
|
||||
_forms.put(event.GetPlayer(), form);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(event.GetPlayer(), form));
|
||||
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(event.GetPlayer(), form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,7 +413,7 @@ public class HideSeek extends TeamGame
|
||||
//Set New
|
||||
_forms.put(player, form);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
|
||||
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -426,7 +447,7 @@ public class HideSeek extends TeamGame
|
||||
//Set New
|
||||
_forms.put(player, form);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
|
||||
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -458,7 +479,7 @@ public class HideSeek extends TeamGame
|
||||
//Set New
|
||||
_forms.put(player, form);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
|
||||
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -14,6 +14,7 @@ import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -139,6 +140,8 @@ public class BlockForm extends Form
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
|
||||
|
||||
//Set Block
|
||||
_block = block;
|
||||
|
||||
|
@ -31,10 +31,10 @@ public class AssistsStatTracker extends StatTracker<Game>
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
getGame().AddStat(player, "Assists", 1, false, false);
|
||||
addStat(player, "Assists", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
|
||||
addStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class BackstabKillStatTracker extends StatTracker<Game>
|
||||
Set<UUID> hasDamaged = _hasDamaged.get(player.getUniqueId());
|
||||
|
||||
if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId()))
|
||||
getGame().AddStat(killer, "Assassination", 1, false, false);
|
||||
addStat(killer, "Assassination", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
|
||||
|
||||
public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
{
|
||||
@ -24,13 +23,12 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChangeForm(HideSeek.ChangeFormEvent event)
|
||||
public void onChangeForm(HideSeek.PlayerChangeFormEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getForm() instanceof CreatureForm)
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@ -42,6 +40,15 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
_disqualified.add(event.getEntity().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerSolidify(HideSeek.PlayerSolidifyEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
@ -50,7 +57,7 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
for (Player player : getGame().getHiders().GetPlayers(true))
|
||||
{
|
||||
if (!_disqualified.contains(player.getUniqueId()))
|
||||
getGame().AddStat(player, "BadHider", 1, true, false);
|
||||
addStat(player, "BadHider", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
|
||||
Long time = getGame().getEnemyTurfEntranceTime(player);
|
||||
|
||||
if (time != null && System.currentTimeMillis() - time >= 15000)
|
||||
getGame().AddStat(player, "BehindEnemyLines", 1, true, false);
|
||||
addStat(player, "BehindEnemyLines", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class BlockShreadStatTracker extends StatTracker<Game>
|
||||
Player shooter = (Player) event.getArrow().getShooter();
|
||||
|
||||
if (getGame().GetKit(shooter) instanceof KitShredder)
|
||||
getGame().AddStat(shooter, "TheShreddinator", 1, false, false);
|
||||
addStat(shooter, "TheShreddinator", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class BloodThirstyStatTracker extends StatTracker<Game>
|
||||
_kills.put(killer.getUniqueId(), kills);
|
||||
|
||||
if (kills >= 50)
|
||||
getGame().AddStat(killer, "BloodThirsty", 1, true, false);
|
||||
addStat(killer, "BloodThirsty", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
|
||||
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
|
||||
|
||||
if (edbee.getDamager() instanceof Arrow)
|
||||
getGame().AddStat(killer, "Sniper", 1, true, false);
|
||||
addStat(killer, "Sniper", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ public class CannibalStatTracker extends StatTracker<Game>
|
||||
_kills.put(event.getKiller().getUniqueId(), killCount);
|
||||
|
||||
if (killCount >= 8)
|
||||
getGame().AddStat(event.getKiller(), "Cannibal", 1, true, false);
|
||||
addStat(event.getKiller(), "Cannibal", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,6 @@ public class ChooChooStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
if (event.getLength() >= 60)
|
||||
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
|
||||
addStat(event.getPlayer(), "ChooChoo", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class ComeAtMeBroStatTracker extends StatTracker<Game>
|
||||
_count.put(killer.getUniqueId(), count);
|
||||
|
||||
if (count >= 2)
|
||||
getGame().AddStat(killer, "ComeAtMeBro", 1, true, false);
|
||||
addStat(killer, "ComeAtMeBro", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ public class DamageDealtStatTracker extends StatTracker<Game>
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||
addStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||
|
||||
if (getGame().GetKit(damager) != null)
|
||||
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||
addStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ public class DamageTakenStatTracker extends StatTracker<Game>
|
||||
if (damagee == null)
|
||||
return;
|
||||
|
||||
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
addStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
|
||||
if (getGame().GetKit(damagee) != null)
|
||||
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class DeathBomberStatTracker extends StatTracker<Game>
|
||||
_killCount.put(killer.getUniqueId(), count);
|
||||
|
||||
if (count >= 5)
|
||||
getGame().AddStat(killer, "DeathBomber", 1, true, false);
|
||||
addStat(killer, "DeathBomber", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ public class DeathsStatTracker extends StatTracker<Game>
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
getGame().AddStat(player, "Deaths", 1, false, false);
|
||||
addStat(player, "Deaths", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
|
||||
addStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
if (event.getStruck().size() >= 4)
|
||||
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
|
||||
addStat(event.getPlayer(), "MassElectrocution", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class FastKillsStatTracker extends StatTracker<Game>
|
||||
_lastKillTime.remove(player.getUniqueId());
|
||||
|
||||
if (killCount >= getRequiredKillCount())
|
||||
getGame().AddStat(killer, getStat(), 1, true, false);
|
||||
addStat(killer, getStat(), 1, true, false);
|
||||
}
|
||||
|
||||
public int getRequiredKillCount()
|
||||
|
@ -21,7 +21,7 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
|
||||
|
||||
if (first)
|
||||
{
|
||||
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
|
||||
addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
@ -42,6 +42,6 @@ public class FoodForTheMassesStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Apple Thrower"))
|
||||
getGame().AddStat(killer, "FoodForTheMasses", 1, false, false);
|
||||
addStat(killer, "FoodForTheMasses", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetKit(winner) != null)
|
||||
{
|
||||
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
|
||||
getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
|
||||
addStat(winner, "FreeKitsForever", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class HunterKillerStatTracker extends StatTracker<Game>
|
||||
_huntersKilled.put(killer.getUniqueId(), huntersKilled);
|
||||
|
||||
if (huntersKilled >= 10)
|
||||
getGame().AddStat(killer, "HunterKiller", 1, true, false);
|
||||
addStat(killer, "HunterKiller", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
|
||||
_hidersKilled.put(killer.getUniqueId(), hidersKilled);
|
||||
|
||||
if (hidersKilled >= 7)
|
||||
getGame().AddStat(killer, "HunterOfTheYear", 1, true, false);
|
||||
addStat(killer, "HunterOfTheYear", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
|
||||
if (event.GetState() == Game.GameState.End)
|
||||
{
|
||||
for (Player player : _guessAll)
|
||||
getGame().AddStat(player, "KeenEye", 1, true, false);
|
||||
addStat(player, "KeenEye", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
|
||||
}
|
||||
|
||||
if (killedAll)
|
||||
getGame().AddStat(player, "Ace", 1, true, false);
|
||||
addStat(player, "Ace", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ public class KillsStatTracker extends StatTracker<Game>
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
getGame().AddStat(player, "Kills", 1, false, false);
|
||||
addStat(player, "Kills", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(player) != null)
|
||||
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
|
||||
addStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
|
||||
_kills.put(player.getUniqueId(), killCount);
|
||||
|
||||
if (killCount == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
|
||||
getGame().AddStat(player, getStat(), 1, true, false);
|
||||
addStat(player, getStat(), 1, true, false);
|
||||
}
|
||||
|
||||
public String getStat()
|
||||
|
@ -47,7 +47,7 @@ public class KingDamageStatTracker extends StatTracker<CastleSiege>
|
||||
Double damage = _kingDamage.get(player.getUniqueId());
|
||||
|
||||
if (damage != null && damage >= 0.5 * _totalKingDamage)
|
||||
getGame().AddStat(player, "Assassin", 1, true, false);
|
||||
addStat(player, "Assassin", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ public class KingSlayerStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
|
||||
addStat(event.getPlayer(), "KingSlayer", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class LastStandStatTracker extends StatTracker<TeamGame>
|
||||
_kills.put(killer.getUniqueId(), kills);
|
||||
|
||||
if (kills >= 3)
|
||||
getGame().AddStat(killer, "LastStand", 1, true, false);
|
||||
addStat(killer, "LastStand", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ public class LoseStatTracker extends StatTracker<Game>
|
||||
{
|
||||
for (Player loser : losers)
|
||||
{
|
||||
getGame().AddStat(loser, "Losses", 1, false, false);
|
||||
addStat(loser, "Losses", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(loser) != null)
|
||||
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
|
||||
addStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ public class MedicStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
|
||||
addStat(event.getPlayer(), "Medic", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ public class MeowStatTracker extends StatTracker<Game>
|
||||
_meowCount.put(event.getPlayer().getUniqueId(), meows);
|
||||
|
||||
if (meows >= 50)
|
||||
getGame().AddStat(event.getPlayer(), "Meow", 1, true, false);
|
||||
addStat(event.getPlayer(), "Meow", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class MrSquiggleStatTracker extends StatTracker<Draw>
|
||||
}
|
||||
|
||||
if (!greaterThan15000)
|
||||
getGame().AddStat(drawer, "MrSquiggle", 1, true, false);
|
||||
addStat(drawer, "MrSquiggle", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class OneVThreeStatTracker extends StatTracker<Game>
|
||||
Integer killCount = _killCount.get(player.getUniqueId());
|
||||
|
||||
if (killCount != null && killCount >= 10)
|
||||
getGame().AddStat(player, "1v3", 1, true, false);
|
||||
addStat(player, "1v3", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class ParalympicsStatTracker extends StatTracker<Game>
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (!_hasLeaped.contains(winner.getUniqueId()))
|
||||
getGame().AddStat(winner, "Paralympics", 1, true, false);
|
||||
addStat(winner, "Paralympics", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ public class PureLuckStatTracker extends StatTracker<Draw>
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
|
||||
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
|
||||
addStat(event.getPlayer(), "PureLuck", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
|
||||
_damageTaken.put(damagee.getUniqueId(), damage);
|
||||
|
||||
if (damage >= 200)
|
||||
getGame().AddStat(damagee, "RecoveryMaster", 1, true, false);
|
||||
addStat(damagee, "RecoveryMaster", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ public class SeismicSlamStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
if (event.getTargets().size() >= 5)
|
||||
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
|
||||
addStat(event.getPlayer(), "Earthquake", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class SharpShooterStatTracker extends StatTracker<Game>
|
||||
Integer arrowsShot = _arrowsShot.get(player.getUniqueId());
|
||||
|
||||
if (arrowsShot != null && arrowsShot == 8)
|
||||
getGame().AddStat(player, "Sharpshooter", 1, true, false);
|
||||
addStat(player, "Sharpshooter", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ public class SheepDropStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
|
||||
addStat(event.getPlayer(), "AnimalRescue", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ public class SheepThiefStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
|
||||
addStat(event.getPlayer(), "Thief", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
|
||||
}
|
||||
|
||||
if (aliveCount >= getRequiredCount())
|
||||
getGame().AddStat(event.getPlayer(), "Skeletons", 1, true, false);
|
||||
addStat(event.getPlayer(), "Skeletons", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,6 @@ public class SlimySheepStatTracker extends StatTracker<Game>
|
||||
_count.put(event.getPlayer().getUniqueId(), count);
|
||||
|
||||
if (count >= 20)
|
||||
getGame().AddStat(event.getPlayer(), "SlimySheep", 1, true, false);
|
||||
addStat(event.getPlayer(), "SlimySheep", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ public class SparklezStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false);
|
||||
addStat(event.getPlayer(), "Sparklez", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ public class SpleefBlockDestroyStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
|
||||
addStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class StatTracker<G extends Game> implements Listener
|
||||
{
|
||||
@ -16,4 +18,15 @@ public class StatTracker<G extends Game> implements Listener
|
||||
{
|
||||
return game;
|
||||
}
|
||||
|
||||
public boolean canAddStats()
|
||||
{
|
||||
return getGame().GetPlayers(false).size() * 4 >= 3 * getGame().Manager.GetPlayerFull();
|
||||
}
|
||||
|
||||
public void addStat(Player player, String stat, int value, boolean limitTo1, boolean global)
|
||||
{
|
||||
if (canAddStats())
|
||||
addStat(player, stat, value, limitTo1, global);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,6 @@ public class TeamDeathsStatTracker extends StatTracker<Game>
|
||||
GameTeam team = getGame().GetTeam(player);
|
||||
|
||||
if (team != null && team.GetName() != null)
|
||||
getGame().AddStat(player, team.GetName() + " Deaths", 1, false, false);
|
||||
addStat(player, team.GetName() + " Deaths", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,6 @@ public class TeamKillsStatTracker extends StatTracker<Game>
|
||||
GameTeam team = getGame().GetTeam(player);
|
||||
|
||||
if (team != null && team.GetName() != null)
|
||||
getGame().AddStat(player, team.GetName() + " Kills", 1, false, false);
|
||||
addStat(player, team.GetName() + " Kills", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class TheComebackStatTracker extends StatTracker<TurfForts>
|
||||
if (_hasWentFiveOrBelow.contains(getGame().WinnerTeam))
|
||||
{
|
||||
for (Player player : getGame().getWinners())
|
||||
getGame().AddStat(player, "TheComeback", 1, true, false);
|
||||
addStat(player, "TheComeback", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
|
||||
Arrow arrow = (Arrow) edbee.getDamager();
|
||||
|
||||
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
|
||||
getGame().AddStat(killer, "TheLongestShot", 1, false, false);
|
||||
addStat(killer, "TheLongestShot", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ public class TntMinerStatTracker extends StatTracker<Game>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
|
||||
addStat(event.getPlayer(), "FortuneBomber", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class WinAsTeamStatTracker extends StatTracker<TeamGame>
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player winner : winners)
|
||||
getGame().AddStat(winner, _stat, 1, false, false);
|
||||
addStat(winner, _stat, 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class WinFastStatTracker extends StatTracker<Game>
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player winner : winners)
|
||||
getGame().AddStat(winner, getStat(), 1, true, false);
|
||||
addStat(winner, getStat(), 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class WinMapStatTracker extends StatTracker<Game>
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player winner : winners)
|
||||
getGame().AddStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
|
||||
addStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ public class WinStatTracker extends StatTracker<Game>
|
||||
{
|
||||
for (Player winner : winners)
|
||||
{
|
||||
getGame().AddStat(winner, "Wins", 1, false, false);
|
||||
addStat(winner, "Wins", 1, false, false);
|
||||
|
||||
if (getGame().GetKit(winner) != null)
|
||||
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
|
||||
addStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class WinWithSheepStatTracker extends StatTracker<SheepGame>
|
||||
if (winners != null)
|
||||
{
|
||||
for (Player winner : winners)
|
||||
getGame().AddStat(winner, "Selfish", 1, true, false);
|
||||
addStat(winner, "Selfish", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (!_hasDied.contains(winner.getUniqueId()))
|
||||
getGame().AddStat(winner, getStat(), 1, true, false);
|
||||
addStat(winner, getStat(), 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
|
||||
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
|
||||
{
|
||||
for (Player player : winner.GetPlayers(true))
|
||||
getGame().AddStat(player, getStat(), 1, true, false);
|
||||
addStat(player, getStat(), 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (!_armorWearers.contains(winner.getUniqueId()))
|
||||
getGame().AddStat(winner, "NoArmor", 1, true, false);
|
||||
addStat(winner, "NoArmor", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user