فهرست منبع

child skills can have their xp bars turned on

nossr50 5 سال پیش
والد
کامیت
239200a3d2

+ 6 - 0
Changelog.txt

@@ -1,3 +1,9 @@
+Version 2.1.127
+    Child Skills now have XP bars, they are hidden by default
+
+    NOTES:
+    You can enable the child skill bars with the command /mmoxpbar <skill> show
+
 Version 2.1.126
     mcMMO now relies on NMS for some of its features, if NMS cannot properly be wired up when initializing mcMMO behaviours relying on NMS will either be partially supported or disabled
     mcMMO now has a compatibility mode, any features that require specific versions of Minecraft for full functionality will be disabled if your server is not running a compatible version, mcMMO will still function in compatibility mode, but either the feature will be modified or disabled depending on the version of the server software

+ 4 - 5
src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java

@@ -190,17 +190,16 @@ public class McMMOPlayer {
 
     public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
     {
-        //Skill Unlock Notifications
-
-        if(primarySkillType.isChildSkill())
-            return;
-
         //XP BAR UPDATES
         experienceBarManager.updateExperienceBar(primarySkillType, plugin);
     }
 
     public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
     {
+        if(primarySkillType.isChildSkill()) {
+            return 1.0D;
+        }
+
         double currentXP = profile.getSkillXpLevel(primarySkillType);
         double maxXP = profile.getXpToLevel(primarySkillType);
 

+ 9 - 0
src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java

@@ -12,6 +12,7 @@ import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
 import com.gmail.nossr50.skills.child.FamilyTree;
 import com.gmail.nossr50.util.player.UserManager;
+import com.gmail.nossr50.util.skills.SkillUtils;
 import com.google.common.collect.ImmutableMap;
 
 import java.util.HashMap;
@@ -266,6 +267,10 @@ public class PlayerProfile {
     }
 
     public int getSkillXpLevel(PrimarySkillType skill) {
+        if(skill.isChildSkill()) {
+            return 0;
+        }
+
         return (int) Math.floor(getSkillXpLevelRaw(skill));
     }
 
@@ -415,6 +420,10 @@ public class PlayerProfile {
      * @return the total amount of Xp until next level
      */
     public int getXpToLevel(PrimarySkillType primarySkillType) {
+        if(primarySkillType.isChildSkill()) {
+            return 0;
+        }
+
         int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType);
         FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
 

+ 14 - 8
src/main/java/com/gmail/nossr50/util/experience/ExperienceBarManager.java

@@ -117,19 +117,25 @@ public class ExperienceBarManager {
                 hideExperienceBar(skillType);
                 break;
             case RESET:
-                //Hide all currently permanent bars
-                for(PrimarySkillType permanent : alwaysVisible) {
-                    hideExperienceBar(permanent);
-                }
-
-                alwaysVisible.clear();
-                disabledBars.clear();
-
+                resetBarSettings();
                 break;
         }
 
         informPlayer(settingTarget, skillType);
+    }
+
+    private void resetBarSettings() {
+        //Hide all currently permanent bars
+        for(PrimarySkillType permanent : alwaysVisible) {
+            hideExperienceBar(permanent);
+        }
+
+        alwaysVisible.clear();
+        disabledBars.clear();
 
+        //Hide child skills by default
+        disabledBars.add(PrimarySkillType.SALVAGE);
+        disabledBars.add(PrimarySkillType.SMELTING);
     }
 
     private void informPlayer(@NotNull ExperienceBarManager.@NotNull XPBarSettingTarget settingTarget, @Nullable PrimarySkillType skillType) {