Add some Nano Games achievements

This commit is contained in:
Sam 2018-09-13 23:00:56 +01:00 committed by Alexander Meech
parent 7508eca03f
commit 1dd451ed42
11 changed files with 560 additions and 84 deletions

View File

@ -1466,6 +1466,46 @@ public enum Achievement
new int[]{1}, new int[]{1},
AchievementCategory.CAKE_WARS), AchievementCategory.CAKE_WARS),
// Nano Games
NANO_WINNER("Nano Winner", 0,
new String[]{"Nano Games.Wins"},
new String[]{"Win Nano Games"},
new int[][] {new int[] {100,0,1000}, new int[] {0,0,5000}, new int[]{0,0,10000}, new int[]{0,0,25000}, new int[]{0,0,50000}},
new int[]{1,10,50,100,500},
"I",
new String[] {"II","III","IV","V","X"},
AchievementCategory.NANO_GAMES),
NANO_PLAY_IN_A_ROW("Player 1", 6000,
new String[]{"Nano Games.PlayInARow"},
new String[]{"Play 100 Games in a row"},
new int[]{1},
AchievementCategory.NANO_GAMES),
NANO_SECOND_PLACE("Better than last!", 500,
new String[]{"Nano Games.SecondPlace"},
new String[]{"Get second place"},
new int[]{1},
AchievementCategory.NANO_GAMES),
NANO_THIRD_PLACE("Still better than last!", 500,
new String[]{"Nano Games.ThirdPlace"},
new String[]{"Get third place"},
new int[]{1},
AchievementCategory.NANO_GAMES),
NANO_CASH_OUT("Cha-Ching", 500,
new String[]{"Nano Games.CashOut"},
new String[]{"Cash out for the first time"},
new int[]{1},
AchievementCategory.NANO_GAMES),
NANO_PLAY("Nani Games?", 500,
new String[]{"Nano Games.Wins", "Nano Games.Losses"},
new String[]{"Play a Nano Game"},
new int[]{1},
AchievementCategory.NANO_GAMES),
; ;
private final String _name; private final String _name;

View File

@ -28,34 +28,34 @@ public enum AchievementCategory
new StatDisplay("Times Voted", "DailyVote"), new StatDisplay("Times Voted", "DailyVote"),
null, null,
new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical")
}, Material.EMERALD, 0, GameCategory.GLOBAL, "None", false, -1), }, Material.EMERALD, 0, GameCategory.STAND_ALONE, "None", false, -1),
HOLIDAY("Holiday Achievements", null, HOLIDAY("Holiday Achievements", null,
new StatDisplay[] {}, new StatDisplay[]{},
Material.CAKE, 0, GameCategory.HOLIDAY, "None", false, -1), Material.CAKE, 0, GameCategory.STAND_ALONE, "None", false, -1),
BRIDGES("The Bridges", null, BRIDGES("The Bridges", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit", false, GameDisplay.Bridge.getGameId()), Material.IRON_PICKAXE, 0, GameCategory.GAME, "Destructor Kit", false, GameDisplay.Bridge.getGameId()),
SURVIVAL_GAMES("Survival Games", null, SURVIVAL_GAMES("Survival Games", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Teams Stats", true), null, null, null, new StatDisplay(C.Bold + "Teams Stats", true), null,
StatDisplay.fromGame("Wins", GameDisplay.SurvivalGamesTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SurvivalGamesTeams, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.SurvivalGamesTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SurvivalGamesTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SurvivalGamesTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SurvivalGamesTeams, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.SurvivalGamesTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SurvivalGamesTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SurvivalGamesTeams, "GemsEarned") }, StatDisplay.fromGame("Gems Earned", GameDisplay.SurvivalGamesTeams, "GemsEarned")},
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit", false, GameDisplay.SurvivalGames.getGameId(), GameDisplay.SurvivalGamesTeams.getGameId()), Material.DIAMOND_SWORD, 0, GameCategory.GAME, "Horseman Kit", false, GameDisplay.SurvivalGames.getGameId(), GameDisplay.SurvivalGamesTeams.getGameId()),
SKYWARS("Skywars",null, SKYWARS("Skywars", null,
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Team Stats", true), null, null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
StatDisplay.fromGame("Wins", GameDisplay.SkywarsTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkywarsTeams, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.SkywarsTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkywarsTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SkywarsTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkywarsTeams, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.SkywarsTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkywarsTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned") }, StatDisplay.fromGame("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned")},
Material.FEATHER, 0, GameCategory.SURVIVAL, "Earth Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()), Material.FEATHER, 0, GameCategory.GAME, "Earth Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()),
UHC("Ultra Hardcore", null, UHC("Ultra Hardcore", null,
new StatDisplay[] { new StatDisplay[]{
new StatDisplay(C.Bold + "Solo Stats", true), new StatDisplay(C.Bold + "Solo Stats", true),
null, null,
StatDisplay.fromGame("Wins", GameDisplay.UHCSolo, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSolo, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.UHCSolo, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSolo, "Wins", "Losses"),
@ -67,11 +67,11 @@ public enum AchievementCategory
null, null,
StatDisplay.fromGame("Wins", GameDisplay.UHC, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHC, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.UHC, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHC, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.UHC, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHC, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.UHC, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHC, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.UHC, "GemsEarned") }, StatDisplay.fromGame("Gems Earned", GameDisplay.UHC, "GemsEarned")},
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSolo.getGameId(), GameDisplay.UHC.getGameId()), Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSolo.getGameId(), GameDisplay.UHC.getGameId()),
UHC_SPEED("Ultra Hardcore Speed", null, UHC_SPEED("Ultra Hardcore Speed", null,
new StatDisplay[] { new StatDisplay[]{
new StatDisplay(C.Bold + "Solo Stats", true), new StatDisplay(C.Bold + "Solo Stats", true),
null, null,
StatDisplay.fromGame("Wins", GameDisplay.UHCSoloSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSoloSpeed, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.UHCSoloSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSoloSpeed, "Wins", "Losses"),
@ -83,7 +83,7 @@ public enum AchievementCategory
null, null,
StatDisplay.fromGame("Wins", GameDisplay.UHCTeamsSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCTeamsSpeed, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.UHCTeamsSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCTeamsSpeed, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.UHCTeamsSpeed, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHCTeamsSpeed, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.UHCTeamsSpeed, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHCTeamsSpeed, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.UHCTeamsSpeed, "GemsEarned") }, StatDisplay.fromGame("Gems Earned", GameDisplay.UHCTeamsSpeed, "GemsEarned")},
Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSoloSpeed.getGameId(), GameDisplay.UHCTeamsSpeed.getGameId()), Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSoloSpeed.getGameId(), GameDisplay.UHCTeamsSpeed.getGameId()),
/*MC_LEAGUE("MC League", null, /*MC_LEAGUE("MC League", null,
@ -91,12 +91,12 @@ public enum AchievementCategory
Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None", true, GameDisplay.Minecraft_League.getGameId()),*/ Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None", true, GameDisplay.Minecraft_League.getGameId()),*/
WIZARDS("Wizards", null, WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit", false, GameDisplay.Wizards.getGameId()), Material.BLAZE_ROD, 0, GameCategory.GAME, "Witch Doctor Kit", false, GameDisplay.Wizards.getGameId()),
CASTLE_ASSAULT("Castle Assault", new String[] {"Castle Assault", "Castle Assault TDM"}, CASTLE_ASSAULT("Castle Assault", new String[]{"Castle Assault", "Castle Assault TDM"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.CROWNS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.CROWNS_EARNED},
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()), Material.DIAMOND_CHESTPLATE, 0, GameCategory.GAME, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()),
CASTLE_SIEGE("Castle Siege", null, CASTLE_SIEGE("Castle Siege", null,
new StatDisplay[] new StatDisplay[]
@ -123,11 +123,11 @@ public enum AchievementCategory
null, null,
StatDisplay.GEMS_EARNED, StatDisplay.GEMS_EARNED,
}, },
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, "Undead Summoner & Castle Paladin Kit", false, GameDisplay.CastleSiege.getGameId()), Material.DIAMOND_CHESTPLATE, 0, GameCategory.GAME, "Undead Summoner & Castle Paladin Kit", false, GameDisplay.CastleSiege.getGameId()),
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null, BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.EGG, 0, GameCategory.CLASSICS, null, false, GameDisplay.BawkBawkBattles.getGameId()), Material.EGG, 0, GameCategory.GAME, null, false, GameDisplay.BawkBawkBattles.getGameId()),
BLOCK_HUNT("Block Hunt", null, BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] new StatDisplay[]
@ -139,75 +139,75 @@ public enum AchievementCategory
StatDisplay.DEATHS, StatDisplay.DEATHS,
StatDisplay.GEMS_EARNED StatDisplay.GEMS_EARNED
}, },
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit", false, GameDisplay.HideSeek.getGameId()), Material.GRASS, 0, GameCategory.GAME, "Infestor Kit", false, GameDisplay.HideSeek.getGameId()),
SMASH_MOBS("Super Smash Mobs", null, SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
null, null, new StatDisplay(C.Bold + "Team Stats", true), null, null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
StatDisplay.fromGame("Wins", GameDisplay.SmashTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SmashTeams, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.SmashTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SmashTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SmashTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SmashTeams, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.SmashTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SmashTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SmashTeams, "GemsEarned")}, StatDisplay.fromGame("Gems Earned", GameDisplay.SmashTeams, "GemsEarned")},
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit", false, GameDisplay.Smash.getGameId(), GameDisplay.SmashTeams.getGameId()), Material.SKULL_ITEM, 4, GameCategory.GAME, "Sheep Kit", false, GameDisplay.Smash.getGameId(), GameDisplay.SmashTeams.getGameId()),
MINE_STRIKE("MineStrike", null, MINE_STRIKE("MineStrike", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.TNT, 0, GameCategory.CLASSICS, "None", false, GameDisplay.MineStrike.getGameId()), Material.TNT, 0, GameCategory.GAME, "None", false, GameDisplay.MineStrike.getGameId()),
DRAW_MY_THING("Draw My Thing", null, DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "None", false, GameDisplay.Draw.getGameId()), Material.BOOK_AND_QUILL, 0, GameCategory.GAME, "None", false, GameDisplay.Draw.getGameId()),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"}, CHAMPIONS("Champions", new String[]{"Champions Domination", "Champions TDM", "Champions CTF"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures")},
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills", false, GameDisplay.ChampionsCTF.getGameId(), GameDisplay.ChampionsDominate.getGameId(), GameDisplay.ChampionsTDM.getGameId()), Material.BEACON, 0, GameCategory.GAME, "Extra Class Skills", false, GameDisplay.ChampionsCTF.getGameId(), GameDisplay.ChampionsDominate.getGameId(), GameDisplay.ChampionsTDM.getGameId()),
MASTER_BUILDERS("Master Builders", null, MASTER_BUILDERS("Master Builders", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.WOOD, 0, GameCategory.CLASSICS, "None", false, GameDisplay.Build.getGameId()), Material.WOOD, 0, GameCategory.GAME, "None", false, GameDisplay.Build.getGameId()),
//Arcade //Arcade
DRAGONS("Dragons", null, DRAGONS("Dragons", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.ENDER_STONE, 0, GameCategory.ARCADE, null, false, GameDisplay.Dragons.getGameId()), Material.ENDER_STONE, 0, GameCategory.ARCADE, null, false, GameDisplay.Dragons.getGameId()),
DRAGON_ESCAPE("Dragon Escape", null, DRAGON_ESCAPE("Dragon Escape", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit", false, GameDisplay.DragonEscape.getGameId()), Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit", false, GameDisplay.DragonEscape.getGameId()),
SHEEP_QUEST("Sheep Quest", null, SHEEP_QUEST("Sheep Quest", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.WOOL, 0, GameCategory.ARCADE, null, false, GameDisplay.Sheep.getGameId()), Material.WOOL, 0, GameCategory.ARCADE, null, false, GameDisplay.Sheep.getGameId()),
SNEAKY_ASSASSINS("Sneaky Assassins", null, SNEAKY_ASSASSINS("Sneaky Assassins", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit", false, GameDisplay.SneakyAssassins.getGameId()), Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit", false, GameDisplay.SneakyAssassins.getGameId()),
ONE_IN_THE_QUIVER("One in the Quiver", null, ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit", false, GameDisplay.Quiver.getGameId()), Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit", false, GameDisplay.Quiver.getGameId()),
SUPER_PAINTBALL("Super Paintball", null, SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit", false, GameDisplay.Paintball.getGameId()), Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit", false, GameDisplay.Paintball.getGameId()),
TURF_WARS("Turf Wars", null, TURF_WARS("Turf Wars", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.HARD_CLAY, 14, GameCategory.ARCADE, null, false, GameDisplay.TurfWars.getGameId()), Material.HARD_CLAY, 14, GameCategory.ARCADE, null, false, GameDisplay.TurfWars.getGameId()),
RUNNER("Runner", null, RUNNER("Runner", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null, false, GameDisplay.Runner.getGameId()), Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null, false, GameDisplay.Runner.getGameId()),
SPLEEF("Super Spleef", null, SPLEEF("Super Spleef", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.IRON_SPADE, 0, GameCategory.ARCADE, null, false, GameDisplay.Spleef.getGameId()), Material.IRON_SPADE, 0, GameCategory.ARCADE, null, false, GameDisplay.Spleef.getGameId()),
DEATH_TAG("Death Tag", null, DEATH_TAG("Death Tag", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.SKULL_ITEM, 0, GameCategory.ARCADE, null, false, GameDisplay.DeathTag.getGameId()), Material.SKULL_ITEM, 0, GameCategory.ARCADE, null, false, GameDisplay.DeathTag.getGameId()),
SNAKE("Snake", null, SNAKE("Snake", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()), Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()),
BACON_BRAWL( BACON_BRAWL(
@ -223,23 +223,23 @@ public enum AchievementCategory
}, Material.PORK, 0, GameCategory.ARCADE, "Chris P Bacon", false, GameDisplay.BaconBrawl.getGameId()), }, Material.PORK, 0, GameCategory.ARCADE, "Chris P Bacon", false, GameDisplay.BaconBrawl.getGameId()),
MICRO_BATTLE("Micro Battle", null, MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null, false, GameDisplay.Micro.getGameId()), Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null, false, GameDisplay.Micro.getGameId()),
BOMB_LOBBERS("Bomb Lobbers", null, BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit", false, GameDisplay.Lobbers.getGameId()), Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit", false, GameDisplay.Lobbers.getGameId()),
EVOLUTION("Evolution", null, EVOLUTION("Evolution", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.MONSTER_EGG, 55 /* slime */, GameCategory.ARCADE, "Harvester Kit", false, GameDisplay.Evolution.getGameId()), Material.MONSTER_EGG, 55 /* slime */, GameCategory.ARCADE, "Harvester Kit", false, GameDisplay.Evolution.getGameId()),
MONSTER_MAZE("Monster Maze", null, MONSTER_MAZE("Monster Maze", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM", false, GameDisplay.MonsterMaze.getGameId()), Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM", false, GameDisplay.MonsterMaze.getGameId()),
GLADIATORS("Gladiators", null, GLADIATORS("Gladiators", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.IRON_SWORD, 0, GameCategory.ARCADE, null, false, GameDisplay.Gladiators.getGameId()), Material.IRON_SWORD, 0, GameCategory.ARCADE, null, false, GameDisplay.Gladiators.getGameId()),
/*TYPE_WARS("Type Wars", null, /*TYPE_WARS("Type Wars", null,
@ -247,28 +247,28 @@ public enum AchievementCategory
Material.NAME_TAG, 0, GameCategory.CLASSICS, null),*/ Material.NAME_TAG, 0, GameCategory.CLASSICS, null),*/
SPEED_BUILDERS("Speed Builders", null, SPEED_BUILDERS("Speed Builders", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")}, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")},
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null, false, GameDisplay.SpeedBuilders.getGameId()), Material.QUARTZ_BLOCK, 0, GameCategory.GAME, null, false, GameDisplay.SpeedBuilders.getGameId()),
/*ONE_IN_THE_QUIVER_PAYLOAD("One in the Quiver Payload", null, /*ONE_IN_THE_QUIVER_PAYLOAD("One in the Quiver Payload", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()),*/ Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()),*/
SKYFALL("Skyfall", null, SKYFALL("Skyfall", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings"), new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings"),
null, null, new StatDisplay(C.Bold + "Team Stats", true), null, null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
StatDisplay.fromGame("Wins", GameDisplay.SkyfallTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkyfallTeams, "Wins", "Losses"), StatDisplay.fromGame("Wins", GameDisplay.SkyfallTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkyfallTeams, "Wins", "Losses"),
StatDisplay.fromGame("Kills", GameDisplay.SkyfallTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkyfallTeams, "Deaths"), StatDisplay.fromGame("Kills", GameDisplay.SkyfallTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkyfallTeams, "Deaths"),
StatDisplay.fromGame("Gems Earned", GameDisplay.SkyfallTeams, "GemsEarned"), null, StatDisplay.fromGame("Booster Rings", GameDisplay.SkyfallTeams, "Rings")}, StatDisplay.fromGame("Gems Earned", GameDisplay.SkyfallTeams, "GemsEarned"), null, StatDisplay.fromGame("Booster Rings", GameDisplay.SkyfallTeams, "Rings")},
Material.DIAMOND_BOOTS, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId()), Material.DIAMOND_BOOTS, 0, GameCategory.GAME, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId()),
GEM_HUNTERS("Gem Hunters", null, GEM_HUNTERS("Gem Hunters", null,
new StatDisplay[] {StatDisplay.KILLS, StatDisplay.GEMS_EARNED, StatDisplay.fromGame("Quests Completed", GameDisplay.GemHunters, "QuestsCompleted"), StatDisplay.fromGame("Chests Opened", GameDisplay.GemHunters, "ChestsOpened")}, new StatDisplay[]{StatDisplay.KILLS, StatDisplay.GEMS_EARNED, StatDisplay.fromGame("Quests Completed", GameDisplay.GemHunters, "QuestsCompleted"), StatDisplay.fromGame("Chests Opened", GameDisplay.GemHunters, "ChestsOpened")},
Material.EMERALD, 0, GameCategory.SURVIVAL, null, false, GameDisplay.GemHunters.getGameId()), Material.EMERALD, 0, GameCategory.GAME, null, false, GameDisplay.GemHunters.getGameId()),
MOBA("Heroes of GWEN", null, MOBA("Heroes of GWEN", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")}, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")},
Material.PRISMARINE_SHARD, 0, GameCategory.CLASSICS, null, false, GameDisplay.MOBA.getGameId()), Material.PRISMARINE_SHARD, 0, GameCategory.GAME, null, false, GameDisplay.MOBA.getGameId()),
CAKE_WARS("Cake Wars", null, CAKE_WARS("Cake Wars", null,
new StatDisplay[] new StatDisplay[]
@ -292,7 +292,17 @@ public enum AchievementCategory
StatDisplay.fromGame("Cake Bites", GameDisplay.CakeWarsDuos, "Bites"), StatDisplay.fromGame("Cake Bites", GameDisplay.CakeWarsDuos, "Bites"),
StatDisplay.fromGame("Whole Cakes", GameDisplay.CakeWarsDuos, "EatWholeCake"), StatDisplay.fromGame("Whole Cakes", GameDisplay.CakeWarsDuos, "EatWholeCake"),
}, },
Material.CAKE, 0, GameCategory.CLASSICS, "Frosting Kit", false, GameDisplay.CakeWars4.getGameId(), GameDisplay.CakeWarsDuos.getGameId()); Material.CAKE, 0, GameCategory.GAME, "Frosting Kit", false, GameDisplay.CakeWars4.getGameId(), GameDisplay.CakeWarsDuos.getGameId()),
NANO_GAMES("Nano Games", null, new StatDisplay[]
{
StatDisplay.WINS,
StatDisplay.GAMES_PLAYED,
StatDisplay.KILLS,
StatDisplay.DEATHS,
}, Material.EGG, 0, GameCategory.GAME, null, false, GameDisplay.NanoGames.getGameId()),
;
private String _name; private String _name;
private String[] _statsToPull; private String[] _statsToPull;
@ -311,10 +321,10 @@ public enum AchievementCategory
if (statsToPull != null) if (statsToPull != null)
_statsToPull = statsToPull; _statsToPull = statsToPull;
else else
_statsToPull = new String[] {name}; _statsToPull = new String[]{name};
_statDisplays = statDisplays; _statDisplays = statDisplays;
_icon = icon; _icon = icon;
_iconData = (byte)iconData; _iconData = (byte) iconData;
_gameCategory = gameCategory; _gameCategory = gameCategory;
_kitReward = kitReward; _kitReward = kitReward;
@ -400,15 +410,15 @@ public enum AchievementCategory
{ {
for (String statName : _statDisplays[i].getStats()) for (String statName : _statDisplays[i].getStats())
{ {
if(_statDisplays[i].isDivideStats()) if (_statDisplays[i].isDivideStats())
{ {
if(statNumber == 0) if (statNumber == 0)
{ {
statNumber = targetStats.getStat(statToPull + "." + statName); statNumber = targetStats.getStat(statToPull + "." + statName);
continue; continue;
} }
double stat = targetStats.getStat(statToPull + "." + statName); double stat = targetStats.getStat(statToPull + "." + statName);
if(stat == 0) if (stat == 0)
statNumber = statNumber / 1; statNumber = statNumber / 1;
else else
statNumber = (double) statNumber / stat; statNumber = (double) statNumber / stat;
@ -426,7 +436,7 @@ public enum AchievementCategory
if (displayName.equalsIgnoreCase("Words Per Minute")) if (displayName.equalsIgnoreCase("Words Per Minute"))
{ {
statString = C.cWhite + (double) statNumber; statString = C.cWhite + (double) statNumber;
if(statString.length() > 7) if (statString.length() > 7)
statString = statString.substring(0, 7); statString = statString.substring(0, 7);
lore.add(C.cYellow + displayName + ": " + statString); lore.add(C.cYellow + displayName + ": " + statString);
@ -446,6 +456,6 @@ public enum AchievementCategory
public enum GameCategory public enum GameCategory
{ {
GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE, UHC STAND_ALONE, GAME, ARCADE, UHC, NANO_GAME
} }
} }

View File

@ -58,6 +58,7 @@ import mineplex.core.serverConfig.ServerConfiguration;
import mineplex.core.sound.SoundNotifier; import mineplex.core.sound.SoundNotifier;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teamspeak.TeamspeakManager; import mineplex.core.teamspeak.TeamspeakManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.thank.ThankManager; import mineplex.core.thank.ThankManager;
@ -140,6 +141,7 @@ public class NanoGames extends JavaPlugin
StatsManager statsManager = new StatsManager(this, clientManager); StatsManager statsManager = new StatsManager(this, clientManager);
EloManager eloManager = new EloManager(this, clientManager); EloManager eloManager = new EloManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager); AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager);
TaskManager taskManager = new TaskManager(this, clientManager);
PartyManager partyManager = new PartyManager(); PartyManager partyManager = new PartyManager();

View File

@ -40,6 +40,7 @@ import mineplex.core.packethandler.PacketHandler;
import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.serverConfig.ServerConfiguration;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.game.nano.commands.game.GameCommand; import mineplex.game.nano.commands.game.GameCommand;
import mineplex.game.nano.commands.spectator.SpectatorCommand; import mineplex.game.nano.commands.spectator.SpectatorCommand;
import mineplex.game.nano.cycle.GameCycle; import mineplex.game.nano.cycle.GameCycle;
@ -91,6 +92,7 @@ public class NanoManager extends MiniPlugin implements IRelation
// Achievement // Achievement
private final StatsManager _statsManager; private final StatsManager _statsManager;
private final AchievementManager _achievementManager; private final AchievementManager _achievementManager;
private final TaskManager _taskManager;
// Chat // Chat
private final Chat _chat; private final Chat _chat;
@ -156,6 +158,7 @@ public class NanoManager extends MiniPlugin implements IRelation
_statsManager = require(StatsManager.class); _statsManager = require(StatsManager.class);
_achievementManager = require(AchievementManager.class); _achievementManager = require(AchievementManager.class);
_taskManager = require(TaskManager.class);
_chat = require(Chat.class); _chat = require(Chat.class);
_chat.setFormatComponents( _chat.setFormatComponents(
@ -383,6 +386,11 @@ public class NanoManager extends MiniPlugin implements IRelation
return _achievementManager; return _achievementManager;
} }
public TaskManager getTaskManager()
{
return _taskManager;
}
public Chat getChat() public Chat getChat()
{ {
return _chat; return _chat;

View File

@ -8,7 +8,7 @@ import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.Managers; import mineplex.core.achievement.Achievement;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.lifetimes.Lifetimed; import mineplex.core.lifetimes.Lifetimed;
@ -25,15 +25,18 @@ import mineplex.game.nano.game.components.prepare.GamePrepareComponent;
import mineplex.game.nano.game.components.scoreboard.GameScoreboardComponent; import mineplex.game.nano.game.components.scoreboard.GameScoreboardComponent;
import mineplex.game.nano.game.components.spectator.GameSpectatorComponent; import mineplex.game.nano.game.components.spectator.GameSpectatorComponent;
import mineplex.game.nano.game.components.spectator.SpectatorComponent; import mineplex.game.nano.game.components.spectator.SpectatorComponent;
import mineplex.game.nano.game.components.stats.GameStatsComponent;
import mineplex.game.nano.game.components.stats.GeneralStatsTracker;
import mineplex.game.nano.game.components.stats.StatsComponent;
import mineplex.game.nano.game.components.team.GameTeam; import mineplex.game.nano.game.components.team.GameTeam;
import mineplex.game.nano.game.components.team.GameTeamComponent; import mineplex.game.nano.game.components.team.GameTeamComponent;
import mineplex.game.nano.game.components.team.TeamComponent; import mineplex.game.nano.game.components.team.TeamComponent;
import mineplex.game.nano.game.components.world.GameWorldComponent;
import mineplex.game.nano.game.components.world.GameWaterComponent; import mineplex.game.nano.game.components.world.GameWaterComponent;
import mineplex.game.nano.game.components.world.GameWorldComponent;
import mineplex.game.nano.game.event.GameStateChangeEvent; import mineplex.game.nano.game.event.GameStateChangeEvent;
import mineplex.game.nano.world.GameWorld; import mineplex.game.nano.world.GameWorld;
public abstract class Game extends ListenerComponent implements Lifetimed, TeamComponent, SpectatorComponent, CurrencyComponent public abstract class Game extends ListenerComponent implements Lifetimed, TeamComponent, SpectatorComponent, CurrencyComponent, StatsComponent
{ {
public enum GameState public enum GameState
@ -64,6 +67,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed, TeamC
protected final GamePlayerComponent _playerComponent; protected final GamePlayerComponent _playerComponent;
protected final GameWaterComponent _waterComponent; protected final GameWaterComponent _waterComponent;
protected final GameCompassComponent _compassComponent; protected final GameCompassComponent _compassComponent;
protected final GameStatsComponent _statsComponent;
protected final GameEndComponent _endComponent; protected final GameEndComponent _endComponent;
// Winners // Winners
@ -89,7 +93,10 @@ public abstract class Game extends ListenerComponent implements Lifetimed, TeamC
_playerComponent = new GamePlayerComponent(this); _playerComponent = new GamePlayerComponent(this);
_waterComponent = new GameWaterComponent(this); _waterComponent = new GameWaterComponent(this);
_compassComponent = new GameCompassComponent(this); _compassComponent = new GameCompassComponent(this);
_statsComponent = new GameStatsComponent(this);
_endComponent = new GameEndComponent(this); _endComponent = new GameEndComponent(this);
new GeneralStatsTracker(this);
} }
public final void setupGameWorld(File mapZip) public final void setupGameWorld(File mapZip)
@ -316,6 +323,22 @@ public abstract class Game extends ListenerComponent implements Lifetimed, TeamC
_manager.getCurrencyManager().addGems(player, amount); _manager.getCurrencyManager().addGems(player, amount);
} }
/*
Stats
*/
@Override
public void addStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
{
_statsComponent.addStat(player, stat, amount, limitTo1, global);
}
@Override
public void rewardAchievement(Player player, Achievement achievement)
{
_statsComponent.rewardAchievement(player, achievement);
}
/* /*
Component Getters Component Getters
*/ */

View File

@ -21,6 +21,7 @@ import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.portal.events.GenericServerTransferEvent; import mineplex.core.portal.events.GenericServerTransferEvent;
import mineplex.core.portal.events.ServerTransferEvent; import mineplex.core.portal.events.ServerTransferEvent;
import mineplex.core.stats.StatsManager;
import mineplex.core.titles.tracks.TrackManager; import mineplex.core.titles.tracks.TrackManager;
import mineplex.core.titles.tracks.standard.GemCollectorTrack; import mineplex.core.titles.tracks.standard.GemCollectorTrack;
import mineplex.game.nano.GameManager; import mineplex.game.nano.GameManager;
@ -139,6 +140,7 @@ public class GameCurrencyManager extends GameManager implements CurrencyComponen
return; return;
} }
StatsManager statsManager = _manager.getStatsManager();
CoreClient client = _manager.getClientManager().Get(player); CoreClient client = _manager.getClientManager().Get(player);
String gameName = NanoManager.getGameDisplay().getName(); String gameName = NanoManager.getGameDisplay().getName();
@ -188,14 +190,19 @@ public class GameCurrencyManager extends GameManager implements CurrencyComponen
{ {
int gamesPlayed = (int) Math.floor(data.Games / 5D); int gamesPlayed = (int) Math.floor(data.Games / 5D);
// TODO enable game specific stats after beta statsManager.incrementStat(player, "Global.GemsEarned", gems);
_manager.getStatsManager().incrementStat(player, "Global.GemsEarned", gems); statsManager.incrementStat(player, gameName + ".GemsEarned", gems);
//_manager.getStatsManager().incrementStat(player, gameName + ".GemsEarned", gems); statsManager.incrementStat(player, "Global.ExpEarned", exp);
_manager.getStatsManager().incrementStat(player, "Global.ExpEarned", exp); statsManager.incrementStat(player, gameName + ".ExpEarned", exp);
//_manager.getStatsManager().incrementStat(player, gameName + ".ExpEarned", exp); statsManager.incrementStat(player, "Global.GamesPlayed", gamesPlayed);
_manager.getStatsManager().incrementStat(player, "Global.GamesPlayed", gamesPlayed);
//_manager.getStatsManager().incrementStat(player, gameName + ".GamesPlayed", data.Games);
require(TrackManager.class).getTrack(GemCollectorTrack.class).earnedGems(player, gems); require(TrackManager.class).getTrack(GemCollectorTrack.class).earnedGems(player, gems);
if (data.Games >= 100)
{
statsManager.incrementStat(player, gameName + ".PlayInARow", 1);
}
statsManager.incrementStat(player, gameName + ".CashOut", 1);
} }
// Remove from session // Remove from session

View File

@ -0,0 +1,242 @@
package mineplex.game.nano.game.components.stats;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementData;
import mineplex.core.achievement.AchievementLog;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.nano.game.Game;
import mineplex.game.nano.game.GameComponent;
public class GameStatsComponent extends GameComponent<Game> implements StatsComponent
{
private final StatsManager _statsManager;
private final TaskManager _taskManager;
private final DonationManager _donationManager;
private final Map<Player, Set<String>> _statsGiven;
public GameStatsComponent(Game game)
{
super(game);
_statsManager = game.getManager().getStatsManager();
_taskManager = game.getManager().getTaskManager();
_donationManager = game.getManager().getDonationManager();
_statsGiven = new HashMap<>();
}
@Override
public void disable()
{
}
@Override
public void addStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
{
if (!getGame().getManager().getServerGroup().getRewardStats())
{
return;
}
Set<String> statsGiven = _statsGiven.computeIfAbsent(player, k -> new HashSet<>());
if (global)
{
stat = AchievementCategory.GLOBAL.getFriendlyName() + "." + stat;
}
else
{
stat = AchievementCategory.NANO_GAMES.getFriendlyName() + "." + stat;
}
if (!statsGiven.add(stat) && limitTo1)
{
return;
}
_statsManager.incrementStat(player, stat, amount);
}
@Override
public void rewardAchievement(Player player, Achievement achievement)
{
getGame().addStat(player, achievement.getStats()[0], 1, true, achievement.getCategory() == AchievementCategory.GLOBAL);
}
/*
Copied from AchievementSummaryComponent
// TODO Replace and reinvent when reimplementing achievements
*/
@EventHandler
public void updateAchievements(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
{
return;
}
AchievementManager manager = getGame().getManager().getAchievementManager();
for (Player player : UtilServer.getPlayersCollection())
{
if (manager.getLog(player) == null)
{
continue;
}
manager.getLog(player).entrySet().forEach(entry ->
{
Achievement achievement = entry.getKey();
AchievementLog log = entry.getValue();
AchievementData data = manager.get(player, achievement);
if (log.LevelUp)
{
String nameLevel = getAchievementName(achievement, data);
StringBuilder description = new StringBuilder();
for (String line : achievement.getDesc())
{
description.append("\n").append(C.cDAqua).append(line);
}
int[] rewards = getRewards(achievement, data.getLevel());
String title;
String reward = getRewardsString(player, rewards);
if (data.getLevel() >= achievement.getMaxLevel())
{
title = C.cPurpleB + "Achievement Get! ";
_taskManager.completedTask(success ->
{
if (success)
{
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.GEM, player, achievement.getName(), achievement.getGemReward());
rewardPlayer(player, achievement, rewards);
}
}, player, achievement.getName());
}
else
{
title = C.cPurpleB + "Achievement Level Up! ";
rewardPlayer(player, achievement, rewards);
}
TextComponent message = new TextComponent(title + C.cGray + nameLevel);
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(C.cAquaB + nameLevel + "\n" + C.cDAqua + description.toString().substring(1) + reward)
.create()));
player.spigot().sendMessage(message);
}
});
}
}
private String getAchievementName(Achievement achievement, AchievementData data)
{
String nameLevel = achievement.getName();
if (achievement.getMaxLevel() > 1)
{
if (achievement.hasLevelNames())
{
String tier = data.getLevel() == 0 ? achievement.getDefaultLevelName() : achievement.getLevelNames()[Math.min(data.getLevel(), achievement.getLevelNames().length) - 1];
nameLevel += " " + tier;
}
else
{
nameLevel += " " + (data.getLevel() + (achievement == Achievement.GLOBAL_GEM_HUNTER ? 1 : 0));
}
}
return nameLevel;
}
private int[] getRewards(Achievement achievement, int level)
{
int gems = 0;
int crowns = 0;
int xp = 0;
if (achievement.getLevelUpRewards().length > 0)
{
int[] rewards = achievement.getLevelUpRewards()[Math.min(level, achievement.getLevelUpRewards().length) - 1];
gems += rewards[0];
crowns += rewards[1];
xp += rewards[2];
}
return new int[]{gems, crowns, xp};
}
private String getRewardsString(Player player, int[] rewards)
{
String reward = "";
int gems = rewards[0];
int crowns = rewards[1];
int xp = rewards[2];
if (gems > 0)
{
reward += C.cGreenB + "+" + gems + " Gems ";
}
if (crowns > 0)
{
reward += C.cGoldB + "+" + crowns + " Crowns ";
}
if (xp > 0 && !_taskManager.hasCompletedTask(player, Achievement.GLOBAL_MINEPLEX_LEVEL.getName()))
{
reward += C.cYellowB + "+" + xp + " EXP ";
}
return reward;
}
private void rewardPlayer(Player player, Achievement achievement, int[] rewards)
{
int gems = rewards[0];
int crowns = rewards[1];
int xp = rewards[2];
if (gems > 0)
{
_donationManager.rewardCurrency(GlobalCurrency.GEM, player, achievement.getName(), gems);
}
if (crowns > 0)
{
_donationManager.rewardCrowns(crowns, player);
}
if (xp > 0)
{
_statsManager.incrementStat(player, Achievement.GLOBAL_MINEPLEX_LEVEL.getStats()[0], xp);
}
}
}

View File

@ -0,0 +1,94 @@
package mineplex.game.nano.game.components.stats;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.nano.game.Game;
import mineplex.game.nano.game.Game.GameState;
import mineplex.game.nano.game.GamePlacements;
import mineplex.game.nano.game.event.GameStateChangeEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
public class GeneralStatsTracker extends StatTracker<Game>
{
private long _gameStartTime;
public GeneralStatsTracker(Game game)
{
super(game);
}
@EventHandler
public void live(GameStateChangeEvent event)
{
if (event.getState() != GameState.Live)
{
return;
}
_gameStartTime = System.currentTimeMillis();
}
@EventHandler
public void killsAndDeaths(CombatDeathEvent event)
{
Player player = event.GetEvent().getEntity();
addStat(player, "Deaths", 1, false, false);
CombatComponent killerComponent = event.GetLog().GetKiller();
if (killerComponent != null)
{
Player killer = UtilPlayer.searchExact(killerComponent.getUniqueIdOfEntity());
if (killer != null)
{
addStat(killer, "Kills", 1, false, false);
}
}
}
@EventHandler
public void winsAndPlayed(GameStateChangeEvent event)
{
if (event.getState() != GameState.End)
{
return;
}
GamePlacements placements = _game.getGamePlacements();
List<Player> allPlayers = _game.getAllPlayers();
List<Player> winners = placements.getWinners();
// Time In Game
int timeInGame = (int) TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - _gameStartTime);
allPlayers.forEach(player -> addStat(player, "TimeInGame", timeInGame, true, true));
allPlayers.removeAll(winners);
// Wins & Losses
winners.forEach(player -> addStat(player, "Wins", 1, true, false));
allPlayers.forEach(player -> addStat(player, "Losses", 1, true, false));
// Second & Third
List<Player> second = placements.getPlayersAtPlace(1), third = placements.getPlayersAtPlace(2);
if (second != null)
{
second.forEach(player -> rewardAchievement(player, Achievement.NANO_SECOND_PLACE));
}
if (third != null)
{
third.forEach(player -> rewardAchievement(player, Achievement.NANO_THIRD_PLACE));
}
}
}

View File

@ -0,0 +1,35 @@
package mineplex.game.nano.game.components.stats;
import java.util.Arrays;
import org.bukkit.entity.Player;
import mineplex.core.achievement.Achievement;
import mineplex.core.lifetimes.ListenerComponent;
import mineplex.game.nano.game.Game;
import mineplex.game.nano.game.Game.GameState;
public class StatTracker<T extends Game> extends ListenerComponent implements StatsComponent
{
protected final T _game;
protected StatTracker(T game)
{
_game = game;
game.getLifetime().register(this, Arrays.asList(GameState.Live, GameState.End));
}
@Override
public void addStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
{
_game.addStat(player, stat, amount, limitTo1, global);
}
@Override
public void rewardAchievement(Player player, Achievement achievement)
{
_game.rewardAchievement(player, achievement);
}
}

View File

@ -0,0 +1,14 @@
package mineplex.game.nano.game.components.stats;
import org.bukkit.entity.Player;
import mineplex.core.achievement.Achievement;
public interface StatsComponent
{
void addStat(Player player, String stat, int amount, boolean limitTo1, boolean global);
void rewardAchievement(Player player, Achievement achievement);
}

View File

@ -85,16 +85,16 @@ public class MineKart extends SoloGame implements IPacketHandler
return 1; return 1;
} }
if (o1.getLap() != o2.getLap())
{
return Integer.compare(o2.getLap(), o1.getLap());
}
if (o1.getLapKeyCheckpoint() != o2.getLapKeyCheckpoint()) if (o1.getLapKeyCheckpoint() != o2.getLapKeyCheckpoint())
{ {
return Integer.compare(o2.getLapKeyCheckpoint(), o1.getLapKeyCheckpoint()); return Integer.compare(o2.getLapKeyCheckpoint(), o1.getLapKeyCheckpoint());
} }
if (o1.getLap() != o2.getLap())
{
return Integer.compare(o2.getLap(), o1.getLap());
}
return Integer.compare(o2.getLapCheckpoint(), o1.getLapCheckpoint()); return Integer.compare(o2.getLapCheckpoint(), o1.getLapCheckpoint());
}; };
@ -207,10 +207,11 @@ public class MineKart extends SoloGame implements IPacketHandler
if (a.getY() == b.getY()) if (a.getY() == b.getY())
{ {
a.subtract(0, 1, 0);
b.add(0, 1, 0); b.add(0, 1, 0);
} }
KartCheckpoint checkpoint = new KartCheckpoint(locations.get(0), locations.get(1), index, args.length > 2); KartCheckpoint checkpoint = new KartCheckpoint(a, b, index, args.length > 2);
_checkpoints.add(checkpoint); _checkpoints.add(checkpoint);
@ -483,7 +484,7 @@ public class MineKart extends SoloGame implements IPacketHandler
{ {
if (!event.isAlive()) if (!event.isAlive())
{ {
Kart kart = _karts.remove(event.getPlayer()); Kart kart = _karts.get(event.getPlayer());
if (kart != null) if (kart != null)
{ {