浏览代码

Move generic Scoreboard settings to General section

nossr50 6 年之前
父节点
当前提交
d139d520e7

+ 20 - 62
src/main/java/com/gmail/nossr50/config/hocon/scoreboard/ConfigScoreboard.java

@@ -6,59 +6,13 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 
 
 @ConfigSerializable
 @ConfigSerializable
 public class ConfigScoreboard {
 public class ConfigScoreboard {
-    /* DEFAULT VALUES */
-    private static final boolean USE_SCOREBOARDS_DEFAULT = false;
-    private static final boolean POWER_LEVEL_DISPLAY_DEFAULT = false;
-    private static final boolean SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT = false;
-    private static final boolean USE_RAINBOW_SKILL_COLORING_DEFAULT = true;
-    private static final boolean USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC = true;
-
-    private static final int SHOW_TIPS_LIMIT_DEFAULT = 10;
 
 
     /*
     /*
      * CONFIG NODES
      * CONFIG NODES
      */
      */
 
 
-    @Setting(value = "Use_Scoreboards", comment = "Whether or not mcMMO should use make use of scoreboards." +
-            "\nPersonally, I find scoreboards quite ugly, so I've disabled them by default." +
-            "\nMost of their functionality has been replaced by the new XP bars (Boss Bars)" +
-            "\nIf you still wish to use scoreboards, you can, just turn this setting on." +
-            "\nDefault value: "+ USE_SCOREBOARDS_DEFAULT)
-    private boolean useScoreboards = USE_SCOREBOARDS_DEFAULT;
-
-    @Setting(value = "Display_Power_Levels_Below_Player_Names",
-            comment = "Whether or not Player power levels should be displayed below " +
-                    "their username (above their 3d model in the world)" +
-                    "\nAlthough it doesn't seem related to scoreboards, displaying a power level for a Player is done" +
-                    "through the use of scoreboards." +
-                    "\nThis is off by default because a lot of Plugins for Minecraft make use of editing" +
-                    " a players \"nameplate\" and that can cause compatibility issues" +
-                    "\nDefault value: "+ POWER_LEVEL_DISPLAY_DEFAULT)
-    private boolean powerLevelTags = POWER_LEVEL_DISPLAY_DEFAULT;
-
-    @Setting(value = "Show_Stats_Scoreboard_On_Player_Login", comment = "Shows the player the /mcstats scoreboard" +
-            " display after they login." +
-            "\nDefault value: "+ SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT)
-    private boolean showStatsAfterLogin = SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT;
-
-    @Setting(value = "Show_Scoreboard_Tips_Only_This_Many_Times", comment = "This determines how many times players are" +
-            " given tips about how to use the scoreboard system before they are never tipped again." +
-            "\nPlayers are given tips once per login session." +
-            "\nDefault value: "+ SHOW_TIPS_LIMIT_DEFAULT)
-    private int tipsAmount = SHOW_TIPS_LIMIT_DEFAULT;
-
-    @Setting(value ="Use_Rainbow_Styling_For_Skill_Names", comment = "If true, skills names will use rainbow style" +
-            " colorings instead of having the same color" +
-            "\nDefault value: "+ USE_RAINBOW_SKILL_COLORING_DEFAULT)
-    private boolean useRainbows = USE_RAINBOW_SKILL_COLORING_DEFAULT;
-
-    @Setting(value = "Use_Super_Ability_Name_Instead_Of_Generic_Name",
-            comment = "If true, scoreboards displaying super ability cooldowns will use the super abilities name " +
-                    "instead of using a generic word from the locale, which by default in the locale is defined as " +
-                    "\"Ability\". The locale key for this entry is - Scoreboard.Misc.Ability " +
-                    "\nExample: If true Tree Feller will be shown instead of Super Ability with default en_us locale entries" +
-                    "\nDefault value: "+ USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC)
-    private boolean useAbilityNameInsteadOfGeneric = USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC;
+    @Setting(value = "General Settings", comment = "Settings that apply to all scoreboards or don't fall into other categories")
+    private ConfigSectionGeneral configSectionGeneral = new ConfigSectionGeneral();
 
 
     @Setting(value = "Scoreboard_Specific_Settings", comment = "Settings for individual scoreboard displays")
     @Setting(value = "Scoreboard_Specific_Settings", comment = "Settings for individual scoreboard displays")
     private ConfigSectionScoreboardTypes configSectionScoreboardTypes = new ConfigSectionScoreboardTypes();
     private ConfigSectionScoreboardTypes configSectionScoreboardTypes = new ConfigSectionScoreboardTypes();
@@ -67,38 +21,42 @@ public class ConfigScoreboard {
      * GETTER BOILERPLATE
      * GETTER BOILERPLATE
      */
      */
 
 
+    public ConfigSectionGeneral getConfigSectionGeneral() {
+        return configSectionGeneral;
+    }
+
+    public ConfigSectionScoreboardTypes getConfigSectionScoreboardTypes() {
+        return configSectionScoreboardTypes;
+    }
+
+    /*
+     * HELPER METHODS
+     */
+
     public boolean getScoreboardsEnabled() {
     public boolean getScoreboardsEnabled() {
-        return useScoreboards;
+        return configSectionGeneral.isUseScoreboards();
     }
     }
 
 
     public boolean getPowerLevelTagsEnabled() {
     public boolean getPowerLevelTagsEnabled() {
-        return powerLevelTags;
+        return configSectionGeneral.isPowerLevelTags();
     }
     }
 
 
     public boolean getShowStatsAfterLogin() {
     public boolean getShowStatsAfterLogin() {
-        return showStatsAfterLogin;
+        return configSectionGeneral.isShowStatsAfterLogin();
     }
     }
 
 
     public int getTipsAmount() {
     public int getTipsAmount() {
-        return tipsAmount;
+        return configSectionGeneral.getTipsAmount();
     }
     }
 
 
     public boolean getUseRainbowSkillStyling() {
     public boolean getUseRainbowSkillStyling() {
-        return useRainbows;
+        return configSectionGeneral.isUseRainbows();
     }
     }
 
 
     public boolean getUseAbilityNamesOverGenerics() {
     public boolean getUseAbilityNamesOverGenerics() {
-        return useAbilityNameInsteadOfGeneric;
-    }
-
-    public ConfigSectionScoreboardTypes getConfigSectionScoreboardTypes() {
-        return configSectionScoreboardTypes;
+        return configSectionGeneral.isUseAbilityNameInsteadOfGeneric();
     }
     }
 
 
-    /*
-     * HELPER METHODS
-     */
-
     public boolean isScoreboardEnabled(ScoreboardManager.SidebarType sidebarType)
     public boolean isScoreboardEnabled(ScoreboardManager.SidebarType sidebarType)
     {
     {
         switch(sidebarType)
         switch(sidebarType)

+ 86 - 0
src/main/java/com/gmail/nossr50/config/hocon/scoreboard/ConfigSectionGeneral.java

@@ -0,0 +1,86 @@
+package com.gmail.nossr50.config.hocon.scoreboard;
+
+import ninja.leaping.configurate.objectmapping.Setting;
+import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
+
+@ConfigSerializable
+public class ConfigSectionGeneral {
+
+    /* DEFAULT VALUES */
+    private static final boolean USE_SCOREBOARDS_DEFAULT = false;
+    private static final boolean POWER_LEVEL_DISPLAY_DEFAULT = false;
+    private static final boolean SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT = false;
+    private static final boolean USE_RAINBOW_SKILL_COLORING_DEFAULT = true;
+    private static final boolean USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC = true;
+
+    private static final int SHOW_TIPS_LIMIT_DEFAULT = 10;
+
+    /*
+     * CONFIG NODES
+     */
+
+    @Setting(value = "Use_Scoreboards", comment = "Whether or not mcMMO should use make use of scoreboards." +
+            "\nPersonally, I find scoreboards quite ugly, so I've disabled them by default." +
+            "\nMost of their functionality has been replaced by the new XP bars (Boss Bars)" +
+            "\nIf you still wish to use scoreboards, you can, just turn this setting on." +
+            "\nDefault value: "+ USE_SCOREBOARDS_DEFAULT)
+    private boolean useScoreboards = USE_SCOREBOARDS_DEFAULT;
+
+    @Setting(value = "Display_Power_Levels_Below_Player_Names",
+            comment = "Whether or not Player power levels should be displayed below " +
+                    "their username (above their 3d model in the world)" +
+                    "\nAlthough it doesn't seem related to scoreboards, displaying a power level for a Player is done" +
+                    " through the use of scoreboards." +
+                    "\nThis is off by default because a lot of Plugins for Minecraft make use of editing" +
+                    " a players \"nameplate\" and that can cause compatibility issues" +
+                    "\nDefault value: "+ POWER_LEVEL_DISPLAY_DEFAULT)
+    private boolean powerLevelTags = POWER_LEVEL_DISPLAY_DEFAULT;
+
+    @Setting(value = "Show_Stats_Scoreboard_On_Player_Login", comment = "Shows the player the /mcstats scoreboard" +
+            " display after they login." +
+            "\nDefault value: "+ SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT)
+    private boolean showStatsAfterLogin = SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT;
+
+    @Setting(value = "Show_Scoreboard_Tips_Only_This_Many_Times", comment = "This determines how many times players are" +
+            " given tips about how to use the scoreboard system before they are never tipped again." +
+            "\nPlayers are given tips once per login session." +
+            "\nDefault value: "+ SHOW_TIPS_LIMIT_DEFAULT)
+    private int tipsAmount = SHOW_TIPS_LIMIT_DEFAULT;
+
+    @Setting(value ="Use_Rainbow_Styling_For_Skill_Names", comment = "If true, skills names will use rainbow style" +
+            " colorings instead of having the same color" +
+            "\nDefault value: "+ USE_RAINBOW_SKILL_COLORING_DEFAULT)
+    private boolean useRainbows = USE_RAINBOW_SKILL_COLORING_DEFAULT;
+
+    @Setting(value = "Use_Super_Ability_Name_Instead_Of_Generic_Name",
+            comment = "If true, scoreboards displaying super ability cooldowns will use the super abilities name " +
+                    "instead of using a generic word from the locale, which by default in the locale is defined as " +
+                    "\"Ability\". The locale key for this entry is - Scoreboard.Misc.Ability " +
+                    "\nExample: If true Tree Feller will be shown instead of Super Ability with default en_us locale entries" +
+                    "\nDefault value: "+ USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC)
+    private boolean useAbilityNameInsteadOfGeneric = USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC;
+
+    public boolean isUseScoreboards() {
+        return useScoreboards;
+    }
+
+    public boolean isPowerLevelTags() {
+        return powerLevelTags;
+    }
+
+    public boolean isShowStatsAfterLogin() {
+        return showStatsAfterLogin;
+    }
+
+    public int getTipsAmount() {
+        return tipsAmount;
+    }
+
+    public boolean isUseRainbows() {
+        return useRainbows;
+    }
+
+    public boolean isUseAbilityNameInsteadOfGeneric() {
+        return useAbilityNameInsteadOfGeneric;
+    }
+}

+ 5 - 5
src/main/java/com/gmail/nossr50/config/hocon/scoreboard/ConfigSectionScoreboardTypes.java

@@ -10,19 +10,19 @@ public class ConfigSectionScoreboardTypes {
      * CONFIG NODES
      * CONFIG NODES
      */
      */
 
 
-    @Setting(value = "Rank_Scoreboard", comment = "Settings for /mcrank")
+    @Setting(value = "Rank_Scoreboard", comment = "Settings for /mcrank Scoreboard")
     private ConfigSectionRankBoard configSectionRankBoard = new ConfigSectionRankBoard();
     private ConfigSectionRankBoard configSectionRankBoard = new ConfigSectionRankBoard();
 
 
-    @Setting(value = "Top_Scoreboard", comment = "Settings for /mctop")
+    @Setting(value = "Top_Scoreboard", comment = "Settings for /mctop Scoreboard")
     private ConfigSectionTopBoard configSectionTopBoard = new ConfigSectionTopBoard();
     private ConfigSectionTopBoard configSectionTopBoard = new ConfigSectionTopBoard();
 
 
-    @Setting(value = "Stats_Scoreboard", comment = "Settings for /mcstats")
+    @Setting(value = "Stats_Scoreboard", comment = "Settings for /mcstats Scoreboard")
     private ConfigSectionStatsBoard configSectionStatsBoard = new ConfigSectionStatsBoard();
     private ConfigSectionStatsBoard configSectionStatsBoard = new ConfigSectionStatsBoard();
 
 
-    @Setting(value = "Inspect_Scoreboard", comment = "Settings for /inspect")
+    @Setting(value = "Inspect_Scoreboard", comment = "Settings for /inspect Scoreboard")
     private ConfigSectionInspectBoard configSectionInspectBoard = new ConfigSectionInspectBoard();
     private ConfigSectionInspectBoard configSectionInspectBoard = new ConfigSectionInspectBoard();
 
 
-    @Setting(value = "Cooldown_Scoreboard", comment = "Settings for /mccooldown")
+    @Setting(value = "Cooldown_Scoreboard", comment = "Settings for /mccooldown Scoreboard")
     private ConfigSectionCooldownBoard configSectionCooldownBoard = new ConfigSectionCooldownBoard();
     private ConfigSectionCooldownBoard configSectionCooldownBoard = new ConfigSectionCooldownBoard();
 
 
     @Setting(value = "Skill_Scoreboard_Settings",
     @Setting(value = "Skill_Scoreboard_Settings",

+ 0 - 3
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -75,9 +75,6 @@ public class mcMMO extends JavaPlugin {
     /* Plugin Checks */
     /* Plugin Checks */
     private static boolean healthBarPluginEnabled;
     private static boolean healthBarPluginEnabled;
 
 
-    // Config Validation Check
-    public boolean noErrorsInConfigFiles = true;
-
     // XP Event Check
     // XP Event Check
     private boolean xpEventEnabled;
     private boolean xpEventEnabled;