child skills can have their xp bars turned on

This commit is contained in:
nossr50 2020-04-28 13:47:33 -07:00
parent e6289a0548
commit 239200a3d2
4 changed files with 33 additions and 13 deletions

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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) {