From ec4cb91a1c26151de39865e5bd4feb37b0c6f144 Mon Sep 17 00:00:00 2001 From: Chiss Date: Thu, 28 Aug 2014 11:50:09 +1000 Subject: [PATCH 1/2] Poll changes Achievement output double space fix --- Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java | 2 +- .../Mineplex.Hub/src/mineplex/hub/poll/PollManager.java | 4 ++-- .../src/mineplex/hub/poll/command/PollCommand.java | 4 ++-- .../game/arcade/managers/GameAchievementManager.java | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java index 3742307ab..9b251ecb2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java @@ -10,7 +10,7 @@ public class HubClient public String PurchaseString = " Purchase Ultra Rank at mineplex.com to unlock all game benefits!"; public int PurchaseIndex = 0; - + public String UltraString = " Thank you for your support!"; public int UltraIndex = 0; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java index e3d47524c..937497aec 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java @@ -119,7 +119,7 @@ public class PollManager extends MiniClientPlugin { String[] answers = poll.getAnswers(); - player.sendMessage(C.cGold + C.Bold + "-----------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "-----------"); + player.sendMessage(C.cGold + C.Bold + "--------------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "--------------"); player.sendMessage(poll.getQuestion()); player.sendMessage(""); for (int i = 1; i <= answers.length; i++) @@ -151,7 +151,7 @@ public class PollManager extends MiniClientPlugin } player.sendMessage(""); player.sendMessage("Click an answer to receive " + C.cGreen + poll.getCoinReward() + " Gems"); - player.sendMessage(C.cGold + C.Bold + "--------------------------"); + player.sendMessage(C.cGold + C.Bold + "--------------------------------"); player.playSound(player.getEyeLocation(), Sound.ORB_PICKUP, 2f, 0f); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java index 123c3af16..9d25b9c0f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java @@ -102,7 +102,7 @@ public class PollCommand extends CommandBase UtilPlayer.message(caller, "Reward: " + C.cYellow + poll.getCoinReward()); UtilPlayer.message(caller, ""); - DecimalFormat decimalFormat = new DecimalFormat("#.##"); + DecimalFormat decimalFormat = new DecimalFormat("#.#"); double aPercent = stats.getAPercent(); double bPercent = stats.getBPercent(); double cPercent = stats.getCPercent(); @@ -123,7 +123,7 @@ public class PollCommand extends CommandBase percent = dPercent; UtilPlayer.message(caller, answer); - UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(percent) + "%" + C.cWhite + ")"); + UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(100d*percent) + "%" + C.cWhite + ")"); } } UtilPlayer.message(caller, " "); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java index 19b7dd2a1..3ed17593e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java @@ -82,7 +82,7 @@ public class GameAchievementManager implements Listener //Display for (final Achievement type : log.keySet()) { - UtilPlayer.message(player, ""); + AchievementData data = Manager.GetAchievement().get(player, type); @@ -100,6 +100,7 @@ public class GameAchievementManager implements Listener //Finishing for the first time if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName())) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") + " " + F.elem(C.cGreen + C.Bold + "+" + type.getGemReward() + " Gems")); @@ -122,6 +123,7 @@ public class GameAchievementManager implements Listener //Multi-Level Achievements else if (log.get(type).LevelUp) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!")); @@ -132,6 +134,7 @@ public class GameAchievementManager implements Listener //Single Level if (type.getMaxLevel() == 1) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); } @@ -140,12 +143,14 @@ public class GameAchievementManager implements Listener //Multi Level - Almost Finished if (data.getLevel() == type.getMaxLevel() - 1) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); } //Multi Level - Many levels to go else { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level")); } From bdef9acecddb3de6ba9edcc5bd5106ac2af9812b Mon Sep 17 00:00:00 2001 From: CoderTim Date: Thu, 28 Aug 2014 00:53:54 -0400 Subject: [PATCH 2/2] Fixed DragonEscape win stat tracker --- .../game/games/dragonescape/DragonEscape.java | 25 +++++++++++++++++++ .../game/arcade/stats/WinMapStatTracker.java | 18 +++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 109eacde6..927a914aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -18,7 +18,9 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -43,6 +45,27 @@ import nautilus.game.arcade.stats.WinMapStatTracker; public class DragonEscape extends SoloGame { + public static class PlayerFinishEvent extends PlayerEvent + { + private static final HandlerList HANDLER_LIST = new HandlerList(); + + public static HandlerList getHandlerList() + { + return HANDLER_LIST; + } + + public PlayerFinishEvent(Player who) + { + super(who); + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + } + private ArrayList _ranks = new ArrayList(); private ArrayList _lastScoreboard = new ArrayList(); @@ -254,6 +277,8 @@ public class DragonEscape extends SoloGame _winner = player; this.SetCustomWinLine(player.getName() + " reached the end of the course!"); + Bukkit.getPluginManager().callEvent(new PlayerFinishEvent(player)); + return true; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java index 61e097f72..29b999f9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java @@ -1,13 +1,10 @@ package nautilus.game.arcade.stats; -import java.util.List; - -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.dragonescape.DragonEscape; public class WinMapStatTracker extends StatTracker { @@ -17,17 +14,8 @@ public class WinMapStatTracker extends StatTracker } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onGameStateChange(GameStateChangeEvent event) + public void onDragonEscapePlayerFinish(DragonEscape.PlayerFinishEvent event) { - if (event.GetState() == Game.GameState.End) - { - List winners = getGame().getWinners(); - - if (winners != null) - { - for (Player winner : winners) - addStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false); - } - } + addStat(event.getPlayer(), "Win." + getGame().WorldData.MapName, 1, true, false); } }