bossbar

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 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 ...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().

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

Jump to

Keyboard shortcuts

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