XP bars can now be toggled off

This commit is contained in:
nossr50 2019-01-18 16:18:29 -08:00
parent 66878d72bf
commit e74bc9fd95
4 changed files with 72 additions and 49 deletions

View File

@ -254,9 +254,13 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
{
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained", 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 BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
{
String colorValueFromConfig = config.getString("Experience_Bars.Style."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
for(BarColor barColor : BarColor.values())
{
@ -270,7 +274,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType)
{
String colorValueFromConfig = config.getString("Experience_Bars.Style."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
for(BarStyle barStyle : BarStyle.values())
{

View File

@ -1,5 +1,6 @@
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.mcMMO;
@ -28,6 +29,9 @@ public class ExperienceBarManager {
public void updateExperienceBar(PrimarySkillType primarySkillType, mcMMO plugin)
{
if(!ExperienceConfig.getInstance().isExperienceBarsEnabled() || !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
return;
//Init Bar
if(experienceBars.get(primarySkillType) == null)
experienceBars.put(primarySkillType, new ExperienceBarWrapper(primarySkillType, mcMMOPlayer));

View File

@ -5,7 +5,6 @@ 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;
import org.bukkit.boss.*;
import org.bukkit.entity.Player;

View File

@ -23,56 +23,72 @@
#SOLID
# The bar is one solid piece
Experience_Bars:
# Turn this to false if you wanna disable XP bars
Enable: true
# 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
BarStyle: SEGMENTED_6
Alchemy:
Color: PURPLE
BarStyle: SEGMENTED_6
Archery:
Color: BLUE
BarStyle: SEGMENTED_6
Axes:
Color: BLUE
BarStyle: SEGMENTED_6
Excavation:
Color: YELLOW
BarStyle: SEGMENTED_6
Fishing:
Color: PURPLE
BarStyle: SEGMENTED_6
Herbalism:
Color: GREEN
BarStyle: SEGMENTED_6
Mining:
Color: YELLOW
BarStyle: SEGMENTED_6
Repair:
Color: PURPLE
BarStyle: SEGMENTED_6
Salvage:
Color: PURPLE
BarStyle: SEGMENTED_6
Smelting:
Color: PURPLE
BarStyle: SEGMENTED_6
Swords:
Color: BLUE
BarStyle: SEGMENTED_6
Taming:
Color: RED
BarStyle: SEGMENTED_6
Unarmed:
Color: BLUE
BarStyle: SEGMENTED_6
Woodcutting:
Color: GREEN
BarStyle: SEGMENTED_6
Acrobatics:
Enable: true
Color: PINK
BarStyle: SEGMENTED_6
Alchemy:
Enable: true
Color: PURPLE
BarStyle: SEGMENTED_6
Archery:
Enable: true
Color: BLUE
BarStyle: SEGMENTED_6
Axes:
Enable: true
Color: BLUE
BarStyle: SEGMENTED_6
Excavation:
Enable: true
Color: YELLOW
BarStyle: SEGMENTED_6
Fishing:
Enable: true
Color: PURPLE
BarStyle: SEGMENTED_6
Herbalism:
Enable: true
Color: GREEN
BarStyle: SEGMENTED_6
Mining:
Enable: true
Color: YELLOW
BarStyle: SEGMENTED_6
Repair:
Enable: true
Color: PURPLE
BarStyle: SEGMENTED_6
Salvage:
Enable: true
Color: PURPLE
BarStyle: SEGMENTED_6
Smelting:
Enable: true
Color: PURPLE
BarStyle: SEGMENTED_6
Swords:
Enable: true
Color: BLUE
BarStyle: SEGMENTED_6
Taming:
Enable: true
Color: RED
BarStyle: SEGMENTED_6
Unarmed:
Enable: true
Color: BLUE
BarStyle: SEGMENTED_6
Woodcutting:
Enable: true
Color: GREEN
BarStyle: SEGMENTED_6
#
# Settings for XP formula
###