bossbar

package
v0.9.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BossBar

type BossBar struct {
	// contains filtered or unexported fields
}

BossBar represents a boss bar that may be sent to a player. It is shown as a purple bar with text above it. The health shown by the bar may be changed.

func New

func New(text ...any) BossBar

New creates a new boss bar with the text passed. The text is formatted according to the rules of fmt.Sprintln. By default, the boss bar will have a full health bar. To change this, use BossBar.WithHealthPercentage(). The default colour of the BossBar is Purple. This can be changed using BossBar.WithColour.

func (BossBar) Colour added in v0.5.0

func (bar BossBar) Colour() Colour

Colour returns the colour of the BossBar.

func (BossBar) HealthPercentage

func (bar BossBar) HealthPercentage() float64

HealthPercentage returns the health percentage of the boss bar. The number returned is a value between 0 and 1, with 0 being an empty boss bar and 1 being a full one.

func (BossBar) Text

func (bar BossBar) Text() string

Text returns the text of the boss bar: The text passed when creating the bar using New().

func (BossBar) WithColour added in v0.5.0

func (bar BossBar) WithColour(c Colour) BossBar

WithColour returns a copy of the BossBar with the Colour passed.

func (BossBar) WithHealthPercentage

func (bar BossBar) WithHealthPercentage(v float64) BossBar

WithHealthPercentage sets the health percentage of the boss bar. The value passed must be between 0 and 1. If a value out of that range is passed, WithHealthPercentage panics. The new BossBar with the changed health percentage is returned.

type Colour added in v0.5.0

type Colour struct {
	// contains filtered or unexported fields
}

Colour is the colour of a BossBar.

func Blue added in v0.5.0

func Blue() Colour

Blue is the colour for a blue boss bar.

func Green added in v0.5.0

func Green() Colour

Green is the colour for a green boss bar.

func Grey added in v0.5.0

func Grey() Colour

Grey is the colour for a grey boss bar.

func Purple added in v0.5.0

func Purple() Colour

Purple is the colour for a purple boss bar.

func Red added in v0.5.0

func Red() Colour

Red is the colour for a red boss bar.

func White added in v0.5.0

func White() Colour

White is the colour for a white boss bar.

func Yellow added in v0.5.0

func Yellow() Colour

Yellow is the colour for a yellow boss bar.

func (Colour) Uint8 added in v0.5.0

func (c Colour) Uint8() uint8

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL