diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index b8c9db367..c51dc9972 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -191,6 +191,13 @@ public enum Achievement new int[]{1}, AchievementCategory.DRAW_MY_THING), + // Master Builders + MASTER_BUILDER_WINS("Master Builder", 1000, + new String[]{"Master Builders.Wins"}, + new String[]{"Win 30 games of Master Builders"}, + new int[]{30}, + AchievementCategory.MASTER_BUILDERS), + //Castle Siege CASTLE_SIEGE_WINS("FOR THE KING!", 600, new String[]{"Castle Siege.ForTheKing"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index cd9bab208..4a8be498d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -12,136 +12,113 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; -/** - * Created by Shaun on 8/21/2014. - * Edited by Chris on 9/13/2059. - */ public enum AchievementCategory { GLOBAL("Global", null, - new String[] { "GemsEarned", null, "GamesPlayed", "TimeInGame" }, - new String[] { "Gems Earned", null, "Games Played", "Time In Game" }, + new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME }, Material.EMERALD, 0, GameCategory.GLOBAL, null), //Survival BRIDGES("The Bridges", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"), SURVIVAL_GAMES("Survival Games", null, - new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" }, - new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" }, - Material.IRON_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"), + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"), + + MINE_STRIKE("MineStrike", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + Material.TNT, 0, GameCategory.CLASSICS, null), + + WIZARDS("Wizards", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), UHC("Ultra Hardcore", null, - new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" }, - new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.GOLD_INGOT, 0, GameCategory.SURVIVAL, "Extra Class Skills"), - - WIZARDS("Wizards", null, - new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" }, - new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" }, - Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), - - MINE_STRIKE("MineStrike", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, - Material.TNT, 0, GameCategory.CLASSICS, null), //Classics SMASH_MOBS("Super Smash Mobs", null, - new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" }, - new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"), BLOCK_HUNT("Block Hunt", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.GRASS, 0, GameCategory.CLASSICS, null), - + + MASTER_BUILDERS("Master Builders", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED }, + Material.WOOD, 0, GameCategory.CLASSICS, null), + DRAW_MY_THING("Draw My Thing", null, - new String[] {"Wins", "Losses", "GemsEarned"}, - new String[] {"Wins", "Losses", "GemsEarned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED }, Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null), CASTLE_SIEGE("Castle Siege", null, - new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), + new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED }, Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null), //Champions CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"), //Arcade DRAGONS("Dragons", null, - new String[] {"Wins", "Losses", "GemsEarned"}, - new String[] {"Wins", "Losses", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED }, Material.ENDER_STONE, 0, GameCategory.ARCADE, null), DRAGON_ESCAPE("Dragon Escape", null, - new String[] {"Wins", "Losses", "GemsEarned"}, - new String[] {"Wins", "Losses", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED }, Material.DRAGON_EGG, 0, GameCategory.ARCADE, null), SHEEP_QUEST("Sheep Quest", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.WOOL, 0, GameCategory.ARCADE, null), SNEAKY_ASSASSINS("Sneaky Assassins", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.INK_SACK, 0, GameCategory.ARCADE, null), ONE_IN_THE_QUIVER("One in the Quiver", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.BOW, 0, GameCategory.ARCADE, null), SUPER_PAINTBALL("Super Paintball", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.ENDER_PEARL, 0, GameCategory.ARCADE, null), TURF_WARS("Turf Wars", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.HARD_CLAY, 14, GameCategory.ARCADE, null), RUNNER("Runner", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null), SPLEEF("Super Spleef", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.IRON_SPADE, 0, GameCategory.ARCADE, null), DEATH_TAG("Death Tag", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.SKULL_ITEM, 0, GameCategory.ARCADE, null), SNAKE("Snake", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.WOOL, 4, GameCategory.ARCADE, null), BACON_BRAWL("Bacon Brawl", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.PORK, 0, GameCategory.ARCADE, null), MICRO_BATTLE("Micro Battle", null, - new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"}, - new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.LAVA, 0, GameCategory.ARCADE, null), ; @@ -149,14 +126,13 @@ public enum AchievementCategory private String _name; private String[] _statsToPull; - private String[] _statsToDisplay; - private String[] _friendlyStatNames; + private StatDisplay[] _statDisplays; private Material _icon; private GameCategory _gameCategory; private byte _iconData; private String _kitReward; - AchievementCategory(String name, String[] statsToPull, String[] statsToDisplay, String[] friendlyStatNames, Material icon, int iconData, GameCategory gameCategory, String kitReward) + AchievementCategory(String name, String[] statsToPull, StatDisplay[] statDisplays, Material icon, int iconData, GameCategory gameCategory, String kitReward) { _name = name; @@ -164,9 +140,7 @@ public enum AchievementCategory _statsToPull = statsToPull; else _statsToPull = new String[] {name}; - - _statsToDisplay = statsToDisplay; - _friendlyStatNames = friendlyStatNames; + _statDisplays = statDisplays; _icon = icon; _iconData = (byte)iconData; _gameCategory = gameCategory; @@ -193,9 +167,9 @@ public enum AchievementCategory return _statsToPull; } - public String[] getStatsToDisplay() + public StatDisplay[] getStatsToDisplay() { - return _statsToDisplay; + return _statDisplays; } public byte getIconData() @@ -208,11 +182,6 @@ public enum AchievementCategory return _gameCategory; } - public String[] getFriendlyStatNames() - { - return _friendlyStatNames; - } - public void addStats(CoreClientManager clientManager, StatsManager statsManager, List lore, Player player, Player target) { addStats(clientManager, statsManager, lore, Integer.MAX_VALUE, player, target); @@ -221,29 +190,32 @@ public enum AchievementCategory public void addStats(CoreClientManager clientManager, StatsManager statsManager, List lore, int max, Player player, Player target) { PlayerStats stats = statsManager.Get(target); - for (int i = 0; i < _statsToDisplay.length && i < max; i++) + for (int i = 0; i < _statDisplays.length && i < max; i++) { // If the stat is null then just display a blank line instead - if (_statsToDisplay[i] == null || _friendlyStatNames[i] == null) + if (_statDisplays[i] == null) { lore.add(" "); continue; } + String displayName = _statDisplays[i].getDisplayName(); + // Skip showing Losses, Kills, Deaths for other players - if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (_statsToDisplay[i].contains("Losses") || _statsToDisplay[i].contains("Kills") || _statsToDisplay[i].contains("Deaths") || _statsToDisplay[i].equals("Time In Game") || _statsToDisplay.equals("Games Played"))) + if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played"))) continue; int statNumber = 0; for (String statToPull : _statsToPull) - statNumber += stats.getStat(statToPull + "." + _statsToDisplay[i]); + for (String statName : _statDisplays[i].getStats()) + statNumber += stats.getStat(statToPull + "." + statName); String statString = C.cWhite + statNumber; // Need to display special for time - if (_statsToDisplay[i].equalsIgnoreCase("TimeInGame")) + if (displayName.equalsIgnoreCase("Time In Game")) statString = C.cWhite + UtilTime.convertString(statNumber * 1000L, 0, UtilTime.TimeUnit.FIT); - lore.add(C.cYellow + _friendlyStatNames[i] + ": " + statString); + lore.add(C.cYellow + displayName + ": " + statString); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java new file mode 100644 index 000000000..23d65027c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java @@ -0,0 +1,44 @@ +package mineplex.core.achievement; + +/** + * The purpose of extracting stats to this class is so we can display stats that are a combination + * of different stat values. For example, since we don't have a specific stat for games played of a game, + * we can use this class to display the stat "Games Played" that sums up "Wins" and "Losses" + * See: StatDisplay.GAMES_PLAYED_GAME + */ +public class StatDisplay +{ + public String _displayName; + public String[] _stats; + + public StatDisplay(String stat) + { + _displayName = stat; + _stats = new String[] { stat }; + } + + public StatDisplay(String displayName, String... stats) + { + _displayName = displayName; + _stats = stats; + } + + public String getDisplayName() + { + return _displayName; + } + + public String[] getStats() + { + return _stats; + } + + public static final StatDisplay WINS = new StatDisplay("Wins"); + public static final StatDisplay LOSSES = new StatDisplay("Losses"); + public static final StatDisplay KILLS = new StatDisplay("Kills"); + public static final StatDisplay DEATHS = new StatDisplay("Deaths"); + public static final StatDisplay GEMS_EARNED = new StatDisplay("Gems Earned", "GemsEarned"); + public static final StatDisplay TIME_IN_GAME = new StatDisplay("Time In Game", "TimeInGame"); + public static final StatDisplay GAMES_PLAYED_GAME = new StatDisplay("Games Played", "Wins", "Losses"); + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java index ff678620d..b78f6f25b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java @@ -45,11 +45,11 @@ public class AchievementMainPage extends ShopPageBase pageLayout = new ItemLayout( "XXXXOXXXX", + "XOXOXOXOX", "XXXXXXXXX", - "OXOXOXOXO", + "XOXOXOXOX", "XXXXXXXXX", - "OXOXOXOXO", - "XXXXOXXXX").getItemSlots(); + "XOXOXOXOX").getItemSlots(); int listSlot = 0; for (AchievementCategory category : AchievementCategory.values()) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index b44ee054a..da19364e2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -39,7 +39,7 @@ public class ServerGameMenu extends ShopPageBase public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { - super(plugin, quickShop, clientManager, donationManager, name, player, 56); + super(plugin, quickShop, clientManager, donationManager, name, player, 47); createSuperSmashCycle(); createMinigameCycle();