From df8f050cf12c17b3660b07a26b3c81ecdd4d648d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 18 Jan 2019 17:21:05 -0800 Subject: [PATCH] Child Skills will not trigger XP bars (for now) --- .../gmail/nossr50/config/experience/ExperienceConfig.java | 7 ++++--- .../com/gmail/nossr50/datatypes/player/McMMOPlayer.java | 4 ++-- .../nossr50/util/experience/ExperienceBarWrapper.java | 4 ++++ src/main/resources/experience.yml | 7 ++++++- src/main/resources/locale/locale_en_US.properties | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 74d106228..82fb79458 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -252,11 +252,12 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { */ public boolean getDoExperienceBarsAlwaysUpdateTitle() { - return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained", false); + return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false); } - public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable"); } - public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable");} + public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);} + public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); } + public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);} public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index ab1529fbd..d2f6e89fe 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -149,8 +149,8 @@ public class McMMOPlayer { public void updateXPBar(PrimarySkillType primarySkillType, mcMMO plugin) { - /*if(experienceBarManager == null) - experienceBarManager = new ExperienceBarManager(this);*/ + if(primarySkillType.isChildSkill()) + return; experienceBarManager.updateExperienceBar(primarySkillType, plugin); } diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java index 1c460be50..c30a03dff 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java @@ -55,6 +55,10 @@ public class ExperienceBarWrapper { } private String getTitleTemplate() { + //If they are using extra details + if(ExperienceConfig.getInstance().getAddExtraDetails()) + return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel()); + return LocaleLoader.getString("XPBar."+niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel()); } diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 5c10d7a98..38d980b22 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -28,7 +28,12 @@ Experience_Bars: # If you want to use a fancy edited title from the locale, then you'll probably want to turn this on, but it will make your server do a lot more work! # I recommend leaving this off! ThisMayCauseLag: - AlwaysUpdateTitlesWhenXPIsGained: false + ExtraDetails: + Enable: false + AlwaysUpdateTitlesWhenXPIsGained: + Enable: false + # You can make your own custom details in the locale file without having to use the ExtraDetails setting! + ExtraDetails: true Acrobatics: Enable: true Color: PINK diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 15c200a54..334f4fb2e 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -94,6 +94,8 @@ XPBar.Swords=Swords Lv.[[GOLD]]{0} XPBar.Taming=Taming Lv.[[GOLD]]{0} XPBar.Unarmed=Unarmed Lv.[[GOLD]]{0} XPBar.Woodcutting=Woodcutting Lv.[[GOLD]]{0} +#This is just a preset template that gets used if the 'ExtraDetails' setting is turned on in experience.yml (off by default), you can ignore this template and just edit the strings above +XPBar.Complex.Template={0} [[YELLOW]]([[GREEN]]{1}[[YELLOW]]/[[GREEN]]{2}[[YELLOW]])[[DARK_AQUA]] {4}[[WHITE]]% Power Lvl.[[RED]]{3} # XP BAR Allows for the following variables -- {0} = Skill Level, {1} Current XP, {2} XP Needed for next level, {3} Power Level, {4} Percentage of Level # Make sure you turn on Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained if you want the XP bar title to update every time a player gains XP! # END STYLING