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); 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) 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()) for(BarColor barColor : BarColor.values())
{ {
@ -270,7 +274,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) 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()) for(BarStyle barStyle : BarStyle.values())
{ {

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.util.experience; 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.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -28,6 +29,9 @@ public class ExperienceBarManager {
public void updateExperienceBar(PrimarySkillType primarySkillType, mcMMO plugin) public void updateExperienceBar(PrimarySkillType primarySkillType, mcMMO plugin)
{ {
if(!ExperienceConfig.getInstance().isExperienceBarsEnabled() || !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
return;
//Init Bar //Init Bar
if(experienceBars.get(primarySkillType) == null) if(experienceBars.get(primarySkillType) == null)
experienceBars.put(primarySkillType, new ExperienceBarWrapper(primarySkillType, mcMMOPlayer)); 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.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.boss.*; import org.bukkit.boss.*;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -23,56 +23,72 @@
#SOLID #SOLID
# The bar is one solid piece # The bar is one solid piece
Experience_Bars: 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! # 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! # I recommend leaving this off!
ThisMayCauseLag: ThisMayCauseLag:
AlwaysUpdateTitlesWhenXPIsGained: false AlwaysUpdateTitlesWhenXPIsGained: false
Style: Acrobatics:
Acrobatics: Enable: true
Color: PINK Color: PINK
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Alchemy: Alchemy:
Color: PURPLE Enable: true
BarStyle: SEGMENTED_6 Color: PURPLE
Archery: BarStyle: SEGMENTED_6
Color: BLUE Archery:
BarStyle: SEGMENTED_6 Enable: true
Axes: Color: BLUE
Color: BLUE BarStyle: SEGMENTED_6
BarStyle: SEGMENTED_6 Axes:
Excavation: Enable: true
Color: YELLOW Color: BLUE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Fishing: Excavation:
Color: PURPLE Enable: true
BarStyle: SEGMENTED_6 Color: YELLOW
Herbalism: BarStyle: SEGMENTED_6
Color: GREEN Fishing:
BarStyle: SEGMENTED_6 Enable: true
Mining: Color: PURPLE
Color: YELLOW BarStyle: SEGMENTED_6
BarStyle: SEGMENTED_6 Herbalism:
Repair: Enable: true
Color: PURPLE Color: GREEN
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Salvage: Mining:
Color: PURPLE Enable: true
BarStyle: SEGMENTED_6 Color: YELLOW
Smelting: BarStyle: SEGMENTED_6
Color: PURPLE Repair:
BarStyle: SEGMENTED_6 Enable: true
Swords: Color: PURPLE
Color: BLUE BarStyle: SEGMENTED_6
BarStyle: SEGMENTED_6 Salvage:
Taming: Enable: true
Color: RED Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Unarmed: Smelting:
Color: BLUE Enable: true
BarStyle: SEGMENTED_6 Color: PURPLE
Woodcutting: BarStyle: SEGMENTED_6
Color: GREEN Swords:
BarStyle: SEGMENTED_6 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 # Settings for XP formula
### ###