mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
XP Bars now can have custom titles (edit the locale)
This commit is contained in:
parent
43da10a855
commit
f5590ce334
@ -250,6 +250,10 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
/*
|
||||
* Experience Bar Stuff
|
||||
*/
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
||||
{
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained", false);
|
||||
}
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars.Style."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.util.experience;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
@ -55,12 +56,16 @@ public class ExperienceBarWrapper {
|
||||
}
|
||||
|
||||
private String getTitleTemplate() {
|
||||
return niceSkillName + " Lv." + ChatColor.GOLD + getLevel();
|
||||
return LocaleLoader.getString("XPBar."+niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
|
||||
}
|
||||
|
||||
private int getLevel() {
|
||||
return mcMMOPlayer.getSkillLevel(primarySkillType);
|
||||
}
|
||||
private int getCurrentXP() { return mcMMOPlayer.getSkillXpLevel(primarySkillType); }
|
||||
private int getMaxXP() { return mcMMOPlayer.getXpToLevel(primarySkillType); }
|
||||
private int getPowerLevel() { return mcMMOPlayer.getPowerLevel(); }
|
||||
private int getPercentageOfLevel() { return (int) (mcMMOPlayer.getProgressInCurrentSkillLevel(primarySkillType) * 100); }
|
||||
|
||||
public String getTitle() {
|
||||
return bossBar.getTitle();
|
||||
@ -97,7 +102,7 @@ public class ExperienceBarWrapper {
|
||||
bossBar.setProgress(v);
|
||||
|
||||
//Every time progress updates we need to check for a title update
|
||||
if(getLevel() != lastLevelUpdated)
|
||||
if(getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle())
|
||||
{
|
||||
updateTitle();
|
||||
lastLevelUpdated = getLevel();
|
||||
|
@ -23,6 +23,10 @@
|
||||
#SOLID
|
||||
# The bar is one solid piece
|
||||
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
|
||||
Style:
|
||||
Acrobatics:
|
||||
Color: PINK
|
||||
|
@ -77,8 +77,25 @@ MOTD.Version.Overhaul=[[GOLD]][mcMMO] [[DARK_AQUA]]Overhaul Era[[GOLD]] - [[DARK
|
||||
Overhaul.mcMMO.Header=[[RED]][]=====[][[GREEN]] mcMMO - Overhaul Era [[RED]][]=====[]
|
||||
Overhaul.mcMMO.Url.Wrap.Prefix=[[RED]][|
|
||||
Overhaul.mcMMO.Url.Wrap.Suffix=[[RED]]|]
|
||||
Overhaul.ASCII.Art.HeaderOne=[[DARK_AQUA]]|||||||||||||||||||||||||||||||||||||| [[GOLD]] {0} [[DARK_AQUA]]||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
# 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!
|
||||
XPBar.Acrobatics=Acrobatics Lv.[[GOLD]]{0}
|
||||
XPBar.Alchemy=Alchemy Lv.[[GOLD]]{0}
|
||||
XPBar.Archery=Archery Lv.[[GOLD]]{0}
|
||||
XPBar.Axes=Axes Lv.[[GOLD]]{0}
|
||||
XPBar.Excavation=Excavation Lv.[[GOLD]]{0}
|
||||
XPBar.Fishing=Fishing Lv.[[GOLD]]{0}
|
||||
XPBar.Herbalism=Herbalism Lv.[[GOLD]]{0}
|
||||
XPBar.Mining=Mining Lv.[[GOLD]]{0}
|
||||
XPBar.Repair=Repair Lv.[[GOLD]]{0}
|
||||
XPBar.Salvage=Salvage Lv.[[GOLD]]{0}
|
||||
XPBar.Smelting=Smelting Lv.[[GOLD]]{0}
|
||||
XPBar.Swords=Swords Lv.[[GOLD]]{0}
|
||||
XPBar.Taming=Taming Lv.[[GOLD]]{0}
|
||||
XPBar.Unarmed=Unarmed Lv.[[GOLD]]{0}
|
||||
XPBar.Woodcutting=Woodcutting Lv.[[GOLD]]{0}
|
||||
# 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
|
||||
|
||||
#ACROBATICS
|
||||
|
Loading…
Reference in New Issue
Block a user