diff --git a/.gitignore b/.gitignore index c1fc8b034..970fac184 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ update Reference /Plugins/.idea/workspace.xml +/Plugins/.idea/tasks.xml /Plugins/out BungeeCord /Plugins/Mineplex.Bungee.Mineplexer/*.gitignore diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml index bcc0470f4..f7936ba2e 100644 --- a/Plugins/.idea/modules.xml +++ b/Plugins/.idea/modules.xml @@ -11,7 +11,6 @@ - diff --git a/Plugins/Libraries/Votifier.jar b/Plugins/Libraries/Votifier.jar new file mode 100644 index 000000000..9751f180a Binary files /dev/null and b/Plugins/Libraries/Votifier.jar differ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 5b81e40ea..636176b02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -6,9 +6,11 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilTime; +import mineplex.core.game.GameDisplay; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -24,11 +26,19 @@ public enum AchievementCategory Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"), 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, + 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("Gems Earned", GameDisplay.SurvivalGamesTeams, "GemsEarned") }, Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"), 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, + 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("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned") }, Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit"), UHC("Ultra Hardcore", null, @@ -49,7 +59,11 @@ public enum AchievementCategory Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"), 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, + 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("Gems Earned", GameDisplay.SmashTeams, "GemsEarned")}, Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"), MINE_STRIKE("MineStrike", null, @@ -203,6 +217,11 @@ public enum AchievementCategory lore.add(" "); continue; } + else if (_statDisplays[i].isJustDisplayName()) + { + lore.add(ChatColor.RESET + _statDisplays[i].getDisplayName()); + continue; + } String displayName = _statDisplays[i].getDisplayName(); @@ -211,9 +230,21 @@ public enum AchievementCategory continue; int statNumber = 0; - for (String statToPull : _statsToPull) + + + // This is so we could load stats from other games + // (Refer to team games, displaying team stats in the normal game view) + if (_statDisplays[i].isFullStat()) + { for (String statName : _statDisplays[i].getStats()) - statNumber += stats.getStat(statToPull + "." + statName); + statNumber += stats.getStat(statName); + } + else + { + for (String statToPull : _statsToPull) + for (String statName : _statDisplays[i].getStats()) + statNumber += stats.getStat(statToPull + "." + statName); + } String statString = C.cWhite + statNumber; // Need to display special for time @@ -224,8 +255,8 @@ public enum AchievementCategory } } - public static enum GameCategory + public enum GameCategory { - GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE; + GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java index b8b58f100..ea7515827 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java @@ -1,5 +1,7 @@ package mineplex.core.achievement; +import mineplex.core.game.GameDisplay; + /** * 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, @@ -8,19 +10,34 @@ package mineplex.core.achievement; */ public class StatDisplay { - public String _displayName; - public String[] _stats; + private String _displayName; + private String[] _stats; + private boolean _fullStat; + private boolean _justDisplayName; public StatDisplay(String stat) + { + this(stat, false); + } + + public StatDisplay(String stat, boolean justDisplayName) { _displayName = stat; _stats = new String[] { stat }; + _fullStat = false; + _justDisplayName = justDisplayName; } public StatDisplay(String displayName, String... stats) + { + this(displayName, false, stats); + } + + public StatDisplay(String displayName, boolean fullStat, String... stats) { _displayName = displayName; _stats = stats; + _fullStat = fullStat; } public String getDisplayName() @@ -28,11 +45,32 @@ public class StatDisplay return _displayName; } + public boolean isJustDisplayName() + { + return _justDisplayName; + } + public String[] getStats() { return _stats; } + public boolean isFullStat() + { + return _fullStat; + } + + public static StatDisplay fromGame(String name, GameDisplay gameDisplay, String... stats) + { + String[] formattedStats = new String[stats.length]; + for (int i = 0; i < stats.length; i++) + { + formattedStats[i] = gameDisplay.getName() + "." + stats[i]; + } + + return new StatDisplay(name, true, formattedStats); + } + public static final StatDisplay WINS = new StatDisplay("Wins"); public static final StatDisplay LOSSES = new StatDisplay("Losses"); public static final StatDisplay KILLS = new StatDisplay("Kills");