From bd611ee11ca65f2d14806be3d06ab7bb034f4a33 Mon Sep 17 00:00:00 2001 From: riking Date: Fri, 25 Oct 2013 11:39:24 -0700 Subject: [PATCH] Add message to /mcscoreboard keep when a board is not shown --- .../com/gmail/nossr50/commands/McscoreboardCommand.java | 4 ++++ .../gmail/nossr50/util/scoreboards/ScoreboardManager.java | 8 +++++--- src/main/resources/locale/locale_en_US.properties | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java b/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java index 7b1c46be2..5c408ede7 100644 --- a/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java @@ -35,6 +35,10 @@ public class McscoreboardCommand implements TabExecutor { sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); return true; } + if (!ScoreboardManager.isBoardShown(sender.getName())) { + sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.NoBoard")); + return true; + } ScoreboardManager.keepBoard(sender.getName()); sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Keep")); } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index 033042efb..3889febfa 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -371,14 +371,16 @@ public class ScoreboardManager { } } + public static boolean isBoardShown(String playerName) { + return PLAYER_SCOREBOARDS.get(playerName).isBoardShown(); + } + public static void clearBoard(String playerName) { PLAYER_SCOREBOARDS.get(playerName).tryRevertBoard(); } public static void keepBoard(String playerName) { - if (Config.getInstance().getAllowKeepBoard()) { - PLAYER_SCOREBOARDS.get(playerName).cancelRevert(); - } + PLAYER_SCOREBOARDS.get(playerName).cancelRevert(); } public static void setRevertTimer(String playerName, int seconds) { diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index e705ce003..3e13f545e 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -524,13 +524,14 @@ Commands.Reset.All=[[GREEN]]All of your skill levels have been reset successfull Commands.Reset.Single=[[GREEN]]Your {0} skill level has been reset successfully. Commands.Reset=[[RED]]Reset a skill's level to 0 Commands.Scoreboard.Clear=[[DARK_AQUA]]mcMMO scoreboard cleared. +Commands.Scoreboard.NoBoard=[[RED]]The mcMMO scoreboard is not active. Commands.Scoreboard.Keep=[[DARK_AQUA]]The mcMMO scoreboard will stay up until you use [[GREEN]]/mcscoreboard clear[[DARK_AQUA]]. #Commands.Scoreboard.Timer=[[BLUE]]This scoreboard will remain visible for [[GOLD]]{1}[[BLUE]] seconds. Commands.Scoreboard.Help.0=[[GOLD]] == [[GREEN]]Help for [[RED]]/mcscoreboard[[GOLD]] == Commands.Scoreboard.Help.1=[[DARK_AQUA]]/mcscoreboard[[AQUA]] clear [[WHITE]] - clear the McMMO scoreboard Commands.Scoreboard.Help.2=[[DARK_AQUA]]/mcscoreboard[[AQUA]] keep [[WHITE]] - keep the mcMMO scoreboard up Commands.Scoreboard.Help.3=[[DARK_AQUA]]/mcscoreboard[[AQUA]] time [n] [[WHITE]] - clear the McMMO scoreboard after [[LIGHT_PURPLE]]n[[WHITE]] seconds -Commands.Scoreboard.Tip.Keep=[[GOLD]]Tip: Use [[RED]]/mcscoreboard keep[[GOLD]] to keep the scoreboard from going away. +Commands.Scoreboard.Tip.Keep=[[GOLD]]Tip: Use [[RED]]/mcscoreboard keep[[GOLD]] while the scoreboard is shown to keep it from going away. Commands.Scoreboard.Tip.Clear=[[GOLD]]Tip: Use [[RED]]/mcscoreboard clear[[GOLD]] to get rid of the scoreboard. Commands.Skill.Invalid=[[RED]]That is not a valid skillname! Commands.Skill.Leaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard--