From 76b29756ff248981e2a25146aea9a13c30654d61 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 10 Dec 2015 02:02:36 +0100 Subject: [PATCH] Fixing some stats and disabling Chat spam messages. --- .../core/achievement/AchievementCategory.java | 11 ++----- .../arcade/game/games/typewars/TypeWars.java | 18 +++++++++-- .../typewars/stats/TimeInGameTracker.java | 32 +++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index a38a5f478..3a016d343 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -268,12 +268,7 @@ public enum AchievementCategory if(stat == 0) statNumber = statNumber / 1; else - { - if(statName.contentEquals("TimeInGame")) - statNumber = (double) statNumber / (double) (stat / 60000); - else - statNumber = (double) statNumber / stat; - } + statNumber = (double) statNumber / stat; } else statNumber += stats.getStat(statToPull + "." + statName); @@ -287,9 +282,9 @@ public enum AchievementCategory // Special display for Words per Minute if (displayName.equalsIgnoreCase("Words Per Minute")) { - statString = C.cWhite + statNumber; + statString = C.cWhite + (double) statNumber * 60000; if(statString.length() > 7) - statString.substring(0, 6); + statString = statString.substring(0, 7); lore.add(C.cYellow + displayName + ": " + statString); continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 0bab7b5ab..3f4a495d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -39,11 +39,13 @@ import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; import nautilus.game.arcade.game.games.typewars.stats.KillsStatTracker; import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.TimeInGameTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.stats.TimeInGameStatTracker; import nautilus.game.arcade.world.WorldData; import org.bukkit.Bukkit; @@ -162,10 +164,12 @@ public class TypeWars extends TeamGame new HoarderStatTracker(this), new PerfectionistStatTracker(this), new WaitForItStatTracker(this), - new KillsStatTracker(this) + new KillsStatTracker(this), + new TimeInGameTracker(this) ); manager.GetCreature().SetDisableCustomDrops(true); + manager.GetChat().setThreeSecondDelay(false); } @EventHandler @@ -290,16 +294,20 @@ public class TypeWars extends TeamGame @EventHandler public void Players(UpdateEvent event) { - if(GetState() != GameState.Live && GetState() != GameState.End) return; + if(event.getType() != UpdateType.TICK) + return; + for(Player player : GetPlayers(true)) { player.setAllowFlight(true); player.setFlying(true); UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player); + Recharge.Instance.Reset(player, "Chat Message"); + for(Minion minion : _activeMinions) { if(UtilMath.offset(minion.getEntity().getLocation(), player.getLocation()) < 1) @@ -928,8 +936,13 @@ public class TypeWars extends TeamGame } for (Player player : team.GetPlayers(false)) + { if (player.isOnline()) + { AddGems(player, 10, "Participation", false, false); + AddGems(player, getPlayerKills(player), getPlayerKills(player) + " Minions killed", false, true); + } + } } Iterator minionIterator = _activeMinions.iterator(); @@ -963,6 +976,7 @@ public class TypeWars extends TeamGame //End Manager.GetCreature().SetDisableCustomDrops(false); + Manager.GetChat().setThreeSecondDelay(true); SetState(GameState.End); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java new file mode 100644 index 000000000..fd93fd56f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class TimeInGameTracker extends StatTracker +{ + + public TimeInGameTracker(Game game) + { + super(game); + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if(event.GetState() != GameState.End) + return; + + for(Player player : getGame().GetPlayers(true)) + { + addStat(player, "TimeInGame", (int) (System.currentTimeMillis() - getGame().getGameLiveTime()), false, false); + } + + } + +}