From 5ebcc760c9714358cc64f611d0c9410f7d6228ea Mon Sep 17 00:00:00 2001 From: javipepe Date: Sun, 26 Mar 2017 19:49:14 +0200 Subject: [PATCH] Enchance rotation commands a bit --- PGM/src/main/java/tc/oc/pgm/commands/MapCommands.java | 6 ++++-- .../tc/oc/pgm/rotation/DynamicRotationChangeListener.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/PGM/src/main/java/tc/oc/pgm/commands/MapCommands.java b/PGM/src/main/java/tc/oc/pgm/commands/MapCommands.java index b256faf..934c809 100644 --- a/PGM/src/main/java/tc/oc/pgm/commands/MapCommands.java +++ b/PGM/src/main/java/tc/oc/pgm/commands/MapCommands.java @@ -215,7 +215,7 @@ public class MapCommands { final RotationState rotation = CommandUtils.getRotation(args.getFlag('n'), sender); int page = args.getInteger(0, 1); - new PrettyPaginatedResult(PGMTranslations.get().t("command.map.currentRotation.title", sender)) { + new PrettyPaginatedResult(PGMTranslations.get().t("command.map.currentRotation.title", sender) + "(" + ChatColor.DARK_AQUA + PGM.getMatchManager().getRotationManager().getCurrentRotationName() + ChatColor.RESET + ")") { @Override public String format(PGMMap map, int index) { ChatColor color = index == rotation.getNextId() ? ChatColor.DARK_AQUA : ChatColor.WHITE; return color.toString() + (index + 1) + ". " + map.getInfo().getShortDescription(sender); @@ -240,7 +240,9 @@ public class MapCommands { new PrettyPaginatedResult(PGMTranslations.get().t("command.map.rotationList.title", sender)) { @Override public String format(String rotationName, int index) { int activation = Config.getConfiguration().getInt("rotation.providers.file." + rotationName + ".count"); - return (index % 2 == 0 ? ChatColor.AQUA : ChatColor.DARK_AQUA) + rotationName + (activation > 0 ? ChatColor.GRAY + " " + PGMTranslations.get().t("command.map.rotationList.activatesWith", sender, ChatColor.RED + "" + activation + ChatColor.GRAY) : ""); + boolean current = rotationName.equalsIgnoreCase(PGM.getMatchManager().getRotationManager().getCurrentRotationName()); + + return (current ? ChatColor.GOLD + "\u0187 " : "") + (index % 2 == 0 ? ChatColor.AQUA : ChatColor.DARK_AQUA) + rotationName + (activation > 0 ? ChatColor.GRAY + " " + PGMTranslations.get().t("command.map.rotationList.activatesWith", sender, ChatColor.RED + "" + activation + ChatColor.GRAY) : ""); } }.display(new BukkitWrappedCommandSender(sender), Lists.newArrayList(rotations.keySet()), page); } diff --git a/PGM/src/main/java/tc/oc/pgm/rotation/DynamicRotationChangeListener.java b/PGM/src/main/java/tc/oc/pgm/rotation/DynamicRotationChangeListener.java index 2f61045..841763f 100644 --- a/PGM/src/main/java/tc/oc/pgm/rotation/DynamicRotationChangeListener.java +++ b/PGM/src/main/java/tc/oc/pgm/rotation/DynamicRotationChangeListener.java @@ -31,7 +31,8 @@ public class DynamicRotationChangeListener implements Listener { RotationCategory appr = getAppropriateRotationCategory(playersOnline, rotationManager); if (appr != null && !rotationManager.getCurrentRotationName().equals(appr.toString().toLowerCase())) { - rotationManager.setRotation(rotationManager.getRotation(appr.toString().toLowerCase())); + rotationManager.setRotation(appr.toString().toLowerCase(), rotationManager.getRotation(appr.toString().toLowerCase())); + rotationManager.setCurrentRotationName(appr.toString().toLowerCase()); CycleMatchModule cmm = event.getMatch().needMatchModule(CycleMatchModule.class); cmm.startCountdown(cmm.getConfig().countdown());