Skip to content

Boss

endstone.boss

Classes relating to the boss bars that appear at the top of the player's screen.

Classes:

Name Description
BarColor

Represents the color of a boss bar.

BarFlag

Represents an optional flag that changes the appearance or behaviour of a boss bar.

BarStyle

Represents the segment style of a boss bar.

BossBar

Represents a boss bar that is displayed to players.

BarColor

Bases: Enum

Represents the color of a boss bar.

Attributes:

Name Type Description
BLUE
GREEN
PINK
PURPLE
REBECCA_PURPLE
RED
WHITE
YELLOW

BLUE class-attribute instance-attribute

BLUE = 1

GREEN class-attribute instance-attribute

GREEN = 3

PINK class-attribute instance-attribute

PINK = 0

PURPLE class-attribute instance-attribute

PURPLE = 5

REBECCA_PURPLE class-attribute instance-attribute

REBECCA_PURPLE = 6

RED class-attribute instance-attribute

RED = 2

WHITE class-attribute instance-attribute

WHITE = 7

YELLOW class-attribute instance-attribute

YELLOW = 4

BarFlag

Bases: Enum

Represents an optional flag that changes the appearance or behaviour of a boss bar.

Attributes:

Name Type Description
CREATE_FOG

Creates fog around the world.

DARKEN_SKY

Darkens the sky like during fighting a wither.

CREATE_FOG class-attribute instance-attribute

CREATE_FOG = 1

Creates fog around the world.

DARKEN_SKY class-attribute instance-attribute

DARKEN_SKY = 0

Darkens the sky like during fighting a wither.

BarStyle

Bases: Enum

Represents the segment style of a boss bar.

Attributes:

Name Type Description
SEGMENTED_10

Splits the boss bar into 10 segments.

SEGMENTED_12

Splits the boss bar into 12 segments.

SEGMENTED_20

Splits the boss bar into 20 segments.

SEGMENTED_6

Splits the boss bar into 6 segments.

SOLID

Makes the boss bar solid (no segments).

SEGMENTED_10 class-attribute instance-attribute

SEGMENTED_10 = 2

Splits the boss bar into 10 segments.

SEGMENTED_12 class-attribute instance-attribute

SEGMENTED_12 = 3

Splits the boss bar into 12 segments.

SEGMENTED_20 class-attribute instance-attribute

SEGMENTED_20 = 4

Splits the boss bar into 20 segments.

SEGMENTED_6 class-attribute instance-attribute

SEGMENTED_6 = 1

Splits the boss bar into 6 segments.

SOLID class-attribute instance-attribute

SOLID = 0

Makes the boss bar solid (no segments).

BossBar

Represents a boss bar that is displayed to players.

Methods:

Name Description
add_flag

Add an optional flag to this boss bar.

add_player

Adds the player to this boss bar causing it to display on their screen.

has_flag

Returns whether this boss bar has the passed flag set.

remove_all

Removes all players from this boss bar.

remove_flag

Remove an existing flag on this boss bar.

remove_player

Removes the player from this boss bar causing it to be removed from their screen.

Attributes:

Name Type Description
color BarColor

The color of this boss bar.

is_visible bool

Whether the boss bar is displayed to attached players.

players list[Player]

All players viewing this boss bar.

progress float

The progress of the bar between 0.0 and 1.0.

style BarStyle

The style of this boss bar.

title str

The title of this boss bar.

color property writable

color: BarColor

The color of this boss bar.

is_visible property writable

is_visible: bool

Whether the boss bar is displayed to attached players.

players property

players: list[Player]

All players viewing this boss bar.

progress property writable

progress: float

The progress of the bar between 0.0 and 1.0.

Values should be between 0.0 (empty) and 1.0 (full).

style property writable

style: BarStyle

The style of this boss bar.

title property writable

title: str

The title of this boss bar.

add_flag

add_flag(flag: BarFlag) -> None

Add an optional flag to this boss bar.

Parameters:

Name Type Description Default
flag BarFlag

An optional flag to set on the boss bar.

required

add_player

add_player(player: Player) -> None

Adds the player to this boss bar causing it to display on their screen.

Parameters:

Name Type Description Default
player Player

The player to add.

required

has_flag

has_flag(flag: BarFlag) -> bool

Returns whether this boss bar has the passed flag set.

Parameters:

Name Type Description Default
flag BarFlag

The flag to check.

required

Returns:

Type Description
bool

Whether it has the flag.

remove_all

remove_all() -> None

Removes all players from this boss bar.

remove_flag

remove_flag(flag: BarFlag) -> None

Remove an existing flag on this boss bar.

Parameters:

Name Type Description Default
flag BarFlag

The existing flag to remove.

required

remove_player

remove_player(player: Player) -> None

Removes the player from this boss bar causing it to be removed from their screen.

Parameters:

Name Type Description Default
player Player

The player to remove.

required