From 7d073fdc0da398456dfe9f42daf6c9484216fb93 Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 9 Jul 2015 12:47:40 +1000 Subject: [PATCH] fixed skywars icon changed LOSSES to GAMESPLAYED for consistency --- .../core/achievement/AchievementCategory.java | 12 +++---- .../game/arcade/managers/GameStatManager.java | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 676d45c0c..d777224ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -28,7 +28,7 @@ public enum AchievementCategory SKYWARS("Skywars",null, new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, - Material.DOUBLE_PLANT, 5, GameCategory.SURVIVAL, "Destructor Kit"), + Material.FEATHER, 5, GameCategory.SURVIVAL, "Destructor Kit"), UHC("Ultra Hardcore", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -39,7 +39,7 @@ public enum AchievementCategory Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), CASTLE_SIEGE("Castle Siege", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, 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), @@ -52,7 +52,7 @@ public enum AchievementCategory Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"), MINE_STRIKE("MineStrike", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, 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, null), DRAW_MY_THING("Draw My Thing", null, @@ -60,7 +60,7 @@ public enum AchievementCategory Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null), CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"), MASTER_BUILDERS("Master Builders", null, @@ -89,11 +89,11 @@ public enum AchievementCategory Material.BOW, 0, GameCategory.ARCADE, null), SUPER_PAINTBALL("Super Paintball", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, 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, null), TURF_WARS("Turf Wars", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, 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), RUNNER("Runner", null, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameStatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameStatManager.java index 2c382b578..cc1f81e1e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameStatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameStatManager.java @@ -3,9 +3,13 @@ package nautilus.game.arcade.managers; import java.util.HashMap; import java.util.UUID; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.leaderboard.LeaderboardManager; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.stats.StatTracker; @@ -15,6 +19,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -109,4 +114,35 @@ public class GameStatManager implements Listener Manager.GetStatsManager().incrementStat(event.getPlayer(), "Global.TimeInGame", timeInGame); } } + + @EventHandler + public void statBoostCommand(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/statboost ") && Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER)) + { + event.setCancelled(true); + + String[] tokens = event.getMessage().split(" "); + + if (tokens.length < 2) + return; + + Player player = UtilPlayer.searchOnline(event.getPlayer(), tokens[1], true); + if (player == null) + return; + + for (GameType type : GameType.values()) + { + int wins = UtilMath.r(50); + int loss = UtilMath.r(50); + int play = wins+loss; + + Manager.GetStatsManager().incrementStat(player, type.GetName() + ".Wins", wins); + Manager.GetStatsManager().incrementStat(player, type.GetName() + ".Losses", loss); + Manager.GetStatsManager().incrementStat(player, type.GetName() + ".GamesPlayed", play); + } + + event.getPlayer().sendMessage("Gave Stats: " + player.getName()); + } + } }