Explorar o código

Add message to /mcscoreboard keep when a board is not shown

riking %!s(int64=11) %!d(string=hai) anos
pai
achega
bd611ee11c

+ 4 - 0
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"));
         }

+ 5 - 3
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) {

+ 2 - 1
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--