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) HealthPercentage ¶
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 ¶
Text returns the text of the boss bar: The text passed when creating the bar using New().
func (BossBar) WithColour ¶
WithColour returns a copy of the BossBar with the Colour passed.
func (BossBar) WithHealthPercentage ¶
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.