Skip to content

Commit

Permalink
XP bars can now be toggled off
Browse files Browse the repository at this point in the history
  • Loading branch information
nossr50 committed Jan 19, 2019
1 parent 66878d7 commit e74bc9f
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ public boolean getDoExperienceBarsAlwaysUpdateTitle()
{
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())
{
Expand All @@ -270,7 +274,7 @@ public BarColor getExperienceBarColor(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())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -28,6 +29,9 @@ public ExperienceBarManager(McMMOPlayer mcMMOPlayer)

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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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;
Expand Down
108 changes: 62 additions & 46 deletions src/main/resources/experience.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand Down

0 comments on commit e74bc9f

Please sign in to comment.