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,54 +23,70 @@
#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:
Enable: true
Color: PURPLE Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Archery: Archery:
Enable: true
Color: BLUE Color: BLUE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Axes: Axes:
Enable: true
Color: BLUE Color: BLUE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Excavation: Excavation:
Enable: true
Color: YELLOW Color: YELLOW
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Fishing: Fishing:
Enable: true
Color: PURPLE Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Herbalism: Herbalism:
Enable: true
Color: GREEN Color: GREEN
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Mining: Mining:
Enable: true
Color: YELLOW Color: YELLOW
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Repair: Repair:
Enable: true
Color: PURPLE Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Salvage: Salvage:
Enable: true
Color: PURPLE Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Smelting: Smelting:
Enable: true
Color: PURPLE Color: PURPLE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Swords: Swords:
Enable: true
Color: BLUE Color: BLUE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Taming: Taming:
Enable: true
Color: RED Color: RED
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Unarmed: Unarmed:
Enable: true
Color: BLUE Color: BLUE
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
Woodcutting: Woodcutting:
Enable: true
Color: GREEN Color: GREEN
BarStyle: SEGMENTED_6 BarStyle: SEGMENTED_6
# #