bossbar

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 2 Imported by: 0

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 ...interface{}) 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

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

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

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

Colour is the colour of a BossBar.

func Blue

func Blue() Colour

Blue is the colour for a blue boss bar.

func Green

func Green() Colour

Green is the colour for a green boss bar.

func Grey

func Grey() Colour

Grey is the colour for a grey boss bar.

func Purple

func Purple() Colour

Purple is the colour for a purple boss bar.

func Red

func Red() Colour

Red is the colour for a red boss bar.

func White

func White() Colour

White is the colour for a white boss bar.

func Yellow

func Yellow() Colour

Yellow is the colour for a yellow boss bar.

func (Colour) Uint8

func (c Colour) Uint8() uint8

Jump to

Keyboard shortcuts

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