Skip to content

BossBar

Namespace Mc.Scripting · Kind class (sealed)

public sealed class BossBar : IDisposable, IPluginResource

A 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.

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.

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.

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.

public IReadOnlyCollection<Uuid> Viewers { get; }

The profile ids of the players who see (or will see, when they join) the bar.

public bool Visible { get; set; }

Whether the viewers currently see the bar (hiding keeps the viewer list).

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).
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.

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.

public void Dispose()
public void Remove()

Removes the bar from every viewer and deletes it.

public BossBar RemoveViewer(Player player)

Hides the bar from a player.

Parameters

Name Type Description
player Player The player.

Returns BossBar: This bar.

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.

BossBarColor · BossBarFlags · BossBarStyle · Component · IPluginResource · Player · Uuid