diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java new file mode 100644 index 000000000..c6169edf7 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java @@ -0,0 +1,4 @@ +package com.gmail.nossr50.runnables.skills; + +public class ExperienceBarHideTask { +} diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarManager.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarManager.java new file mode 100644 index 000000000..75d592e8c --- /dev/null +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarManager.java @@ -0,0 +1,5 @@ +package com.gmail.nossr50.util.experience; + +public class ExperienceBar { + +} diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java new file mode 100644 index 000000000..1a6018bac --- /dev/null +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java @@ -0,0 +1,149 @@ +package com.gmail.nossr50.util.experience; + +import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.util.StringUtils; +import org.bukkit.boss.*; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +/** + * A visual representation of a players skill level progress for a PrimarySkillType + */ +public class ExperienceBar { + + private final PrimarySkillType primarySkillType; //Primary Skill + protected String experienceBarTitle; //Name Shown Above XP Bar + protected BarColor barColor; //Color of the XP Bar + protected BarStyle barStyle; + protected Player player; + protected double progress; + protected boolean isVisible; + + public ExperienceBar(PrimarySkillType primarySkillType, Player player) + { + this.player = player; + this.primarySkillType = primarySkillType; + experienceBarTitle = StringUtils.getCapitalized(primarySkillType.getName()); + barColor = ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType); + barStyle = BarStyle.SOLID; + isVisible = false; + progress = 0.0D; + } + + public String getTitle() { + return experienceBarTitle; + } + + public void setTitle(String s) { + experienceBarTitle = s; + } + + public BarColor getColor() { + return barColor; + } + + public void setColor(BarColor barColor) { + this.barColor = barColor; + } + + + public BarStyle getStyle() { + //TODO: Add config for style + return barStyle; + } + + + public void setStyle(BarStyle barStyle) { + this.barStyle = barStyle; + } + + + public void removeFlag(BarFlag barFlag) { + //Do nothing + } + + + public void addFlag(BarFlag barFlag) { + //Do nothing + } + + + public boolean hasFlag(BarFlag barFlag) { + return false; + } + + + public void setProgress(double v) { + //Clamp progress between 0.00 -> 1.00 + + if(v < 0) + progress = 0.0D; + else if(progress > 1) + progress = 1.0D; + else progress = v; + } + + + public double getProgress() { + return progress; + } + + + public void addPlayer(Player player) { + //Do nothing + } + + + public void removePlayer(Player player) { + //Do nothing + } + + + public void removeAll() { + //Do nothing + } + + + public List getPlayers() { + List players = new ArrayList<>(); + players.add(player); + return players; + } + + + public void setVisible(boolean b) { + isVisible = b; + + if(isVisible) + showExperienceBar(); + } + + + public boolean isVisible() { + return isVisible; + } + + public void showExperienceBar() + { + player.getServer().createBossBar() + } + + /** + * @deprecated + */ + + public void show() { + //Do nothing + } + + /** + * @deprecated + */ + + public void hide() { + //Do nothing + } +} diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index da9548d55..e10f2669c 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -6,6 +6,43 @@ # ##### + + +# https://hub.spigotmc.org/javadocs/spigot/org/bukkit/boss/BarColor.html +# These are the only valid colors for Experience Bars, use the exact name found here +# BLUE, GREEN, PINK, PURPLE, RED, WHITE, YELLOW (As of the time of this update these are the only Bar colors available, this could change in the future so check the BarColor enum to see if it has) +Experience_Bars: + Style: + Acrobatics: + Color: BLUE + Alchemy: + Color: BLUE + Archery: + Color: RED + Axes: + Color: RED + Excavation: + Color: YELLOW + Fishing: + Color: BLUE + Herbalism: + Color: GREEN + Mining: + Color: YELLOW + Repair: + Color: BLUE + Salvage: + Color: BLUE + Smelting: + Color: BLUE + Swords: + Color: RED + Taming: + Color: PURPLE + Unarmed: + Color: RED + Woodcutting: + Color: GREEN # # Settings for XP formula ###