BossBar
Namespace Mc.Scripting · Kind class (sealed)
public sealed class BossBar : IDisposable, IPluginResourceA boss bar at the top of the screen, shown to the players who were added as viewers. Create it with BossBars.Create; it disappears from every viewer when the plugin unloads (or when BossBar.Remove is called). Bars are not saved with the world.
Properties
Section titled “Properties”| Member | Description |
|---|---|
BossBarColor Color { get; set; } |
The colour. |
BossBarFlags Flags { get; set; } |
Darkening, music and fog. |
bool IsActive { get; } |
Whether the bar still exists (false after BossBar.Remove or the plugin unloading). |
string Key { get; } |
The full key of the bar (“pluginid:name”); also its id in /bossbar. |
float Progress { get; set; } |
How full the bar is, 0..1. |
BossBarStyle Style { get; set; } |
The segmentation. |
Component Title { get; set; } |
The text above the bar. |
IReadOnlyCollection<Uuid> Viewers { get; } |
The profile ids of the players who see (or will see, when they join) the bar. |
bool Visible { get; set; } |
Whether the viewers currently see the bar (hiding keeps the viewer list). |
public BossBarColor Color { get; set; }The colour.
public BossBarFlags Flags { get; set; }Darkening, music and fog.
IsActive
Section titled “IsActive”public bool IsActive { get; }Whether the bar still exists (false after BossBar.Remove or the plugin unloading).
public string Key { get; }The full key of the bar (“pluginid:name”); also its id in /bossbar.
Progress
Section titled “Progress”public float Progress { get; set; }How full the bar is, 0..1.
public BossBarStyle Style { get; set; }The segmentation.
public Component Title { get; set; }The text above the bar.
Viewers
Section titled “Viewers”public IReadOnlyCollection<Uuid> Viewers { get; }The profile ids of the players who see (or will see, when they join) the bar.
Visible
Section titled “Visible”public bool Visible { get; set; }Whether the viewers currently see the bar (hiding keeps the viewer list).
Methods
Section titled “Methods”| Member | Description |
|---|---|
BossBar AddViewer(Player player) |
Shows the bar to a player until BossBar.RemoveViewer or until the player leaves the server. |
BossBar AddViewer(Uuid player) |
Shows the bar to a player (by profile id, also an offline one: the bar appears when he joins). |
void Dispose() |
|
void Remove() |
Removes the bar from every viewer and deletes it. |
BossBar RemoveViewer(Player player) |
Hides the bar from a player. |
BossBar RemoveViewer(Uuid player) |
Hides the bar from a player (by profile id). |
AddViewer
Section titled “AddViewer”public BossBar AddViewer(Player player)Shows the bar to a player until BossBar.RemoveViewer or until the player leaves the server.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |
Returns BossBar: This bar.
AddViewer
Section titled “AddViewer”public BossBar AddViewer(Uuid player)Shows the bar to a player (by profile id, also an offline one: the bar appears when he joins).
Parameters
| Name | Type | Description |
|---|---|---|
player |
Uuid |
The profile id. |
Returns BossBar: This bar.
Dispose
Section titled “Dispose”public void Dispose()Remove
Section titled “Remove”public void Remove()Removes the bar from every viewer and deletes it.
RemoveViewer
Section titled “RemoveViewer”public BossBar RemoveViewer(Player player)Hides the bar from a player.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |
Returns BossBar: This bar.
RemoveViewer
Section titled “RemoveViewer”public BossBar RemoveViewer(Uuid player)Hides the bar from a player (by profile id).
Parameters
| Name | Type | Description |
|---|---|---|
player |
Uuid |
The profile id. |
Returns BossBar: This bar.
See also
Section titled “See also”BossBarColor · BossBarFlags · BossBarStyle · Component · IPluginResource · Player · Uuid