Registered stat listeners with each game

This commit is contained in:
CoderTim 2014-08-22 17:20:02 -04:00
parent 591b5c026c
commit 02bb53578a
23 changed files with 263 additions and 8 deletions

View File

@ -18,8 +18,17 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.DamageDealtStatTracker;
import nautilus.game.arcade.stats.DamageTakenStatTracker;
import nautilus.game.arcade.stats.DeathsStatTracker;
import nautilus.game.arcade.stats.KillsStatTracker;
import nautilus.game.arcade.stats.LoseStatTracker;
import nautilus.game.arcade.stats.StatTracker;
import nautilus.game.arcade.stats.WinStatTracker;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -197,6 +206,7 @@ public abstract class Game implements Listener
public int EloStart = 1000;
public ArrayList<String> GemBoosters = new ArrayList<String>();
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
@ -233,6 +243,16 @@ public abstract class Game implements Listener
}
WorldData = new WorldData(this);
registerStatTrackers(
new KillsStatTracker(this),
new DeathsStatTracker(this),
new AssistsStatTracker(this),
new WinStatTracker(this),
new LoseStatTracker(this),
new DamageDealtStatTracker(this),
new DamageTakenStatTracker(this)
);
System.out.println("Loading " + GetName() + "...");
}
@ -1081,4 +1101,28 @@ public abstract class Game implements Listener
{
return _stats;
}
public void registerStatTrackers(StatTracker<? extends Game>... statTrackers)
{
for (StatTracker<? extends Game> tracker : statTrackers)
{
if (_statTrackers.add(tracker))
Bukkit.getPluginManager().registerEvents(tracker, Manager.GetPlugin());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End)
{
for (StatTracker tracker : getStatTrackers())
HandlerList.unregisterAll(tracker);
}
}
public Collection<StatTracker<? extends Game>> getStatTrackers()
{
return _statTrackers;
}
}

View File

@ -60,6 +60,10 @@ import nautilus.game.arcade.game.games.bridge.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
public class Bridge extends TeamGame implements OreObsfucation
{
@ -174,6 +178,13 @@ public class Bridge extends TeamGame implements OreObsfucation
_tournament = Manager.IsTournamentServer();
registerStatTrackers(
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new FastKillsStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this)
);
}
@EventHandler

View File

@ -65,6 +65,9 @@ import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadGhoul;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadZombie;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker;
public class CastleSiege extends TeamGame
{
@ -185,6 +188,12 @@ public class CastleSiege extends TeamGame
this.BlockPlaceAllow.add(85);
_kingName = C.cYellow + C.Bold + "King Sparklez";
registerStatTrackers(
new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this),
new AssistsStatTracker(this)
);
}
@Override

View File

@ -13,6 +13,8 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -51,6 +53,11 @@ public class ChampionsDominate extends Domination
EloRanking = false;
EloStart = 1000;
registerStatTrackers(
new ElectrocutionStatTracker(this),
new SeismicSlamStatTracker(this)
);
}
@Override

View File

@ -17,6 +17,10 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class ChampionsTDM extends TeamDeathmatch
{
@ -47,6 +51,13 @@ public class ChampionsTDM extends TeamDeathmatch
};
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
new ElectrocutionStatTracker(this),
new SeismicSlamStatTracker(this)
);
}
@Override

View File

@ -27,6 +27,7 @@ import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.deathtag.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.ComeAtMeBroStatTracker;
public class DeathTag extends SoloGame
{
@ -64,6 +65,8 @@ public class DeathTag extends SoloGame
this.CompassEnabled = true;
this.PrepareFreeze = false;
registerStatTrackers(new ComeAtMeBroStatTracker(this));
}
@Override

View File

@ -38,6 +38,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.dragonescape.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ParalympicsStatTracker;
import nautilus.game.arcade.stats.WinMapStatTracker;
public class DragonEscape extends SoloGame
{
@ -75,6 +77,11 @@ public class DragonEscape extends SoloGame
this.DamagePvP = false;
this.HungerSet = 20;
registerStatTrackers(
new ParalympicsStatTracker(this),
new WinMapStatTracker(this)
);
}
@Override

View File

@ -33,6 +33,7 @@ import nautilus.game.arcade.game.games.dragons.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkSparkler;
import nautilus.game.arcade.stats.SparklezStatTracker;
public class Dragons extends SoloGame
{
@ -62,6 +63,10 @@ public class Dragons extends SoloGame
this.DamagePvP = false;
this.HungerSet = 20;
this.WorldWaterDamage = 4;
registerStatTrackers(
new SparklezStatTracker(this)
);
}
@Override

View File

@ -45,6 +45,9 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.game.games.draw.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KeenEyeStatTracker;
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
import nautilus.game.arcade.stats.PureLuckStatTracker;
public class Draw extends SoloGame
{
@ -99,6 +102,12 @@ public class Draw extends SoloGame
{
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Crack", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
};
registerStatTrackers(
new MrSquiggleStatTracker(this),
new KeenEyeStatTracker(this),
new PureLuckStatTracker(this)
);
}
@Override

View File

@ -79,6 +79,10 @@ import nautilus.game.arcade.game.games.hideseek.forms.Form;
import nautilus.game.arcade.game.games.hideseek.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
@ -204,6 +208,13 @@ public class HideSeek extends TeamGame
Manager.GetExplosion().SetRegenerate(true);
Manager.GetExplosion().SetTNTSpread(false);
Manager.getCosmeticManager().setHideParticles(true);
registerStatTrackers(
new HunterKillerStatTracker(this),
new MeowStatTracker(this),
new HunterKillerStatTracker(this),
new BadHiderStatTracker(this)
);
}
public Material GetItemEquivilent(Material mat)

View File

@ -56,6 +56,11 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class Paintball extends TeamGame
{
@ -111,6 +116,14 @@ public class Paintball extends TeamGame
});
this.HungerSet = 20;
registerStatTrackers(
new FastKillsStatTracker(this, 4, 5, "KillingSpree"),
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new MedicStatTracker(this),
new WinFastStatTracker(this, 20, "Speedrunner"),
new LastStandStatTracker(this)
);
}
@EventHandler

View File

@ -32,6 +32,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.quiver.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.SharpShooterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class Quiver extends SoloGame
{
@ -73,6 +75,11 @@ public class Quiver extends SoloGame
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "Perfectionist"),
new SharpShooterStatTracker(this)
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -52,6 +52,9 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.sheep.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.SheepDropStatTracker;
import nautilus.game.arcade.stats.SheepThiefStatTracker;
import nautilus.game.arcade.stats.WinWithSheepStatTracker;
public class SheepGame extends TeamGame
{
@ -145,6 +148,12 @@ public class SheepGame extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerStatTrackers(
new SheepThiefStatTracker(this),
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
}
@Override

View File

@ -32,6 +32,11 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class SuperSmash extends SoloGame
{
@ -87,6 +92,14 @@ public class SuperSmash extends SoloGame
// Add stat table here
// Example
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new FastKillsStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -51,6 +51,9 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.snake.kits.KitInvulnerable;
import nautilus.game.arcade.game.games.snake.kits.KitSpeed;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.CannibalStatTracker;
import nautilus.game.arcade.stats.ChooChooStatTracker;
import nautilus.game.arcade.stats.SlimySheepStatTracker;
public class Snake extends SoloGame
{
@ -172,6 +175,12 @@ public class Snake extends SoloGame
this.HungerSet = 2;
this.GemMultiplier = 0.5;
registerStatTrackers(
new CannibalStatTracker(this),
new ChooChooStatTracker(this),
new SlimySheepStatTracker(this)
);
}
@EventHandler

View File

@ -37,6 +37,8 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
import nautilus.game.arcade.stats.SpleefBlockDestroyStatTracker;
import net.minecraft.server.v1_7_R4.EntityArrow;
public class Spleef extends SoloGame
@ -63,6 +65,8 @@ public class Spleef extends SoloGame
this.WorldWaterDamage = 4;
this.PrepareFreeze = false;
registerStatTrackers(new SpleefBlockDestroyStatTracker(this));
}
@EventHandler

View File

@ -74,6 +74,11 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.kit.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
public class SurvivalGames extends SoloGame
{
@ -230,6 +235,13 @@ public class SurvivalGames extends SoloGame
System.out.println("CREEP TYPE: " + _spreadName);
System.out.println("===================");
//Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened");
registerStatTrackers(
new WinWithoutWearingArmorStatTracker(this),
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5)
);
}
@Override

View File

@ -50,6 +50,9 @@ import nautilus.game.arcade.game.games.turfforts.kits.KitInfiltrator;
import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman;
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker;
import nautilus.game.arcade.stats.BlockShreadStatTracker;
import nautilus.game.arcade.stats.TheComebackStatTracker;
public class TurfForts extends TeamGame
{
@ -130,6 +133,12 @@ public class TurfForts extends TeamGame
this.ItemDrop = false;
this.ItemPickup = false;
this.DamageSelf = false;
registerStatTrackers(
new BlockShreadStatTracker(this),
new BehindEnemyLinesStatTracker(this),
new TheComebackStatTracker(this)
);
}
@Override

View File

@ -18,13 +18,15 @@ public class FastKillsStatTracker extends StatTracker<Game>
private final Map<UUID, Long> _lastKillTime = new HashMap<>();
private final int _requiredKillCount;
private final String _stat;
private final int _timeBetweenKills;
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills)
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills, String stat)
{
super(game);
_requiredKillCount = requiredKillCount;
_stat = stat;
_timeBetweenKills = timeBetweenKills * 1000;
}
@ -74,7 +76,7 @@ public class FastKillsStatTracker extends StatTracker<Game>
_lastKillTime.remove(player.getUniqueId());
if (killCount >= getRequiredKillCount())
getGame().AddStat(killer, "FastKills", 1, true, false);
getGame().AddStat(killer, getStat(), 1, true, false);
}
public int getRequiredKillCount()
@ -86,4 +88,9 @@ public class FastKillsStatTracker extends StatTracker<Game>
{
return _timeBetweenKills;
}
public String getStat()
{
return _stat;
}
}

View File

@ -11,15 +11,17 @@ import java.util.*;
public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
{
private final int _killCount;
private final String _stat;
private final int _timeLimit;
private final Map<UUID, Integer> _kills = new HashMap<>();
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit)
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit, String stat)
{
super(game);
_killCount = killCount;
_stat = stat;
_timeLimit = timeLimit * 1000;
}
@ -53,6 +55,11 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
_kills.put(player.getUniqueId(), killCount);
if (killCount == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
getGame().AddStat(player, "Bloodlust", 1, true, false);
getGame().AddStat(player, getStat(), 1, true, false);
}
public String getStat()
{
return _stat;
}
}

View File

@ -12,13 +12,15 @@ import nautilus.game.arcade.game.Game;
public class WinFastStatTracker extends StatTracker<Game>
{
private final int _seconds;
private final String _stat;
private long _gameStartTime;
public WinFastStatTracker(Game game, int seconds)
public WinFastStatTracker(Game game, int seconds, String stat)
{
super(game);
_seconds = seconds;
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -35,9 +37,14 @@ public class WinFastStatTracker extends StatTracker<Game>
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, "Speedrunner", 1, true, false);
getGame().AddStat(winner, getStat(), 1, true, false);
}
}
}
}
public String getStat()
{
return _stat;
}
}

View File

@ -0,0 +1,33 @@
package nautilus.game.arcade.stats;
import java.util.List;
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 WinMapStatTracker extends StatTracker<Game>
{
public WinMapStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
}
}
}
}

View File

@ -7,9 +7,12 @@ import org.bukkit.event.*;
public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
{
public WinWithoutLosingTeammateStatTracker(TeamGame game)
private final String _stat;
public WinWithoutLosingTeammateStatTracker(TeamGame game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -22,8 +25,13 @@ public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
{
for (Player player : winner.GetPlayers(true))
getGame().AddStat(player, "FlawlessVictory", 1, true, false);
getGame().AddStat(player, getStat(), 1, true, false);
}
}
}
public String getStat()
{
return _stat;
}
}