mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Added XP Bars
This commit is contained in:
parent
a9ed63d3d0
commit
92b8d13c71
@ -0,0 +1,4 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
public class ExperienceBarHideTask {
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.gmail.nossr50.util.experience;
|
||||
|
||||
public class ExperienceBar {
|
||||
|
||||
}
|
@ -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<Player> getPlayers() {
|
||||
List<Player> 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
|
||||
}
|
||||
}
|
@ -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
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user