public abstract class WauzPlayerBossBar
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected org.bukkit.boss.BossBar |
bossBar
The Minecraft boss bar.
|
protected static java.util.Map<org.bukkit.entity.Player,WauzPlayerBossBar> |
bossBarPlayerLinks
A map of boss bars, indexed by the player they are shown to.
|
protected static java.util.Map<java.lang.String,WauzPlayerBossBar> |
bossBars
A map of all boss bars, indexed by entity uuid.
|
protected double |
maxHealth
Max health shown in the bar.
|
protected java.lang.String |
modifiers
Modifiers shown in the bar.
|
protected java.lang.String |
uuid
The id of the object, this bar belongs to.
|
Constructor and Description |
---|
WauzPlayerBossBar() |
Modifier and Type | Method and Description |
---|---|
void |
addPlayer(org.bukkit.entity.Player player,
double damage)
Adds a player that should see this bar.
|
static void |
clearBar(org.bukkit.entity.Player player)
Removes the shown boss bar for the given player.
|
protected void |
destroy()
Removes this boss bar from all maps and clears out all players.
|
protected abstract void |
doPlayerChecks()
Schedules a task to check if the object and assigned players are still valid.
|
protected abstract double |
getHealth() |
protected abstract java.lang.String |
getName() |
java.lang.String |
getTitle(int health)
Generates a new title for the boss bar.
|
protected boolean |
inDistance(org.bukkit.entity.Player player,
org.bukkit.Location location)
Checks if the given player is close enough to see the boss bar.
|
void |
removePlayer(org.bukkit.entity.Player player)
Removes a player that should no longer see this bar.
|
void |
updateBossBar(double damage)
Updates the boss bar, because the entity got damaged.
|
protected static java.util.Map<java.lang.String,WauzPlayerBossBar> bossBars
protected static java.util.Map<org.bukkit.entity.Player,WauzPlayerBossBar> bossBarPlayerLinks
protected java.lang.String uuid
protected java.lang.String modifiers
protected double maxHealth
protected org.bukkit.boss.BossBar bossBar
public static void clearBar(org.bukkit.entity.Player player)
player
- The player who should no longer see a boss bar.public void addPlayer(org.bukkit.entity.Player player, double damage)
player
- The player that should see this bar.damage
- The damage the player dealt to see the bar.public void removePlayer(org.bukkit.entity.Player player)
player
- The player that should no longer see this bar.public void updateBossBar(double damage)
damage
- The damage that was dealt to the entity.public java.lang.String getTitle(int health)
health
- How much health is left.protected abstract void doPlayerChecks()
destroy()
protected abstract java.lang.String getName()
protected abstract double getHealth()
protected boolean inDistance(org.bukkit.entity.Player player, org.bukkit.Location location)
player
- The player to check for.location
- The current location of the object, this bar belongs to.protected void destroy()