Ver Fonte

Add option to not show ability names on scoreboard

Adds #2249
TfT_02 há 10 anos atrás
pai
commit
0838cbb874

+ 1 - 0
Changelog.txt

@@ -15,6 +15,7 @@ Version 1.5.01-dev
  + Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
  + Added option to config.yml to show the /mcstats scoreboard automatically after logging in
  + Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
+ + Added option to config.yml for Scoreboards, display "Ability" instead of ability names on the scoreboards
  + Added options to experience.yml for Dirt and Sand variations
  + Added support for `MATERIAL|data` format in treasures.yml
  + Added API to experience events to get XP gain reason

+ 1 - 0
src/main/java/com/gmail/nossr50/config/Config.java

@@ -282,6 +282,7 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); }
     public boolean getShowStatsAfterLogin() { return config.getBoolean("Scoreboard.Show_Stats_After_Login", false); }
     public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); }
+    public boolean getShowAbilityNames() { return config.getBoolean("Scoreboard.Ability_Names", true); }
 
     public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
     public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }

+ 16 - 3
src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java

@@ -99,17 +99,17 @@ public class ScoreboardManager {
                 skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName()));
 
                 if (type.getAbility() != null) {
-                    abilityLabelBuilder.put(type.getAbility(), getShortenedName(ChatColor.AQUA + type.getAbility().getName()));
+                    abilityLabelBuilder.put(type.getAbility(), formatAbility(type.getAbility().getName()));
 
                     if (type == SkillType.MINING) {
-                        abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(ChatColor.AQUA + AbilityType.BLAST_MINING.getName()));
+                        abilityLabelBuilder.put(AbilityType.BLAST_MINING, formatAbility(AbilityType.BLAST_MINING.getName()));
                     }
                 }
             }
         }
 
         for (AbilityType type : AbilityType.values()) {
-            abilityLabelSkillBuilder.put(type, getShortenedName((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName()));
+            abilityLabelSkillBuilder.put(type, formatAbility((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), type.getName()));
         }
 
         skillLabels = skillLabelBuilder.build();
@@ -128,6 +128,19 @@ public class ScoreboardManager {
         TOP_BOARD;
     }
 
+    private static String formatAbility(String abilityName) {
+        return formatAbility(ChatColor.AQUA, abilityName);
+    }
+
+    private static String formatAbility(ChatColor color, String abilityName) {
+        if (Config.getInstance().getShowAbilityNames()) {
+            return color + getShortenedName(abilityName);
+        }
+        else {
+            return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
+        }
+    }
+
     private static String getShortenedName(String name) {
         return getShortenedName(name, true);
     }

+ 3 - 0
src/main/resources/config.yml

@@ -48,6 +48,9 @@ Scoreboard:
     # Add some more color on the board :-)
     Rainbows: false
 
+    # Display ability names?
+    Ability_Names: true
+
     # Settings for each type of scoreboard
     # Print: Should the command output be printed in chat?
     # Board: Should the command output be displayed in the scoreboard sidebar?

+ 1 - 0
src/main/resources/locale/locale_en_US.properties

@@ -960,6 +960,7 @@ Scoreboard.Misc.CurrentXP=[[GREEN]]Current XP
 Scoreboard.Misc.RemainingXP=[[YELLOW]]Remaining XP
 Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]Cooldown
 Scoreboard.Misc.Overall=[[GOLD]]Overall
+Scoreboard.Misc.Ability=Ability
 
 #DATABASE RECOVERY
 Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded.