scoreboard

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 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 Scoreboard

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

Scoreboard represents a scoreboard that may be sent to a player. The scoreboard is shown on the right side of the player's screen.

func New

func New(name ...interface{}) *Scoreboard

New returns a new scoreboard with the display name passed. Once returned, lines may be added to the scoreboard to add text to it. The name is formatted according to the rules of fmt.Sprintln. Changing the scoreboard after sending it to a player will not update the scoreboard of the player automatically: Player.SendScoreboard() must be called again to update it.

func (*Scoreboard) Add

func (board *Scoreboard) Add(a ...interface{}) *Scoreboard

Add adds a new line to the scoreboard using the content passed. The values passed are formatting according to the rules of fmt.Sprintln.

func (*Scoreboard) Addf

func (board *Scoreboard) Addf(format string, a ...interface{}) *Scoreboard

Addf adds a new line to the scoreboard using a custom format. The formatting specifiers are the same as those of fmt.Sprintf.

func (*Scoreboard) Clear

func (board *Scoreboard) Clear() *Scoreboard

Clear clears all lines from the scoreboard and resets it to its state directly after initialising the scoreboard.

func (*Scoreboard) Lines

func (board *Scoreboard) Lines() []string

Lines returns a list of all lines of the scoreboard. The order is the order in which they were added using Scoreboard.Add().

func (*Scoreboard) Name

func (board *Scoreboard) Name() string

Name returns the display name of the scoreboard, as passed during the construction of the scoreboard.

func (*Scoreboard) Remove

func (board *Scoreboard) Remove(index int) *Scoreboard

Remove removes the line with the index passed and shifts down all lines after it. Remove panics if the index passed is out of range.

func (*Scoreboard) RemoveLast

func (board *Scoreboard) RemoveLast() *Scoreboard

RemoveLast removes the last line of the scoreboard. Nothing happens if the scoreboard is empty.

func (*Scoreboard) Set

func (board *Scoreboard) Set(index int, a ...interface{}) *Scoreboard

Set sets a line on the scoreboard to a new value passed, formatting the values according to the rules of fmt.Sprintln. Set panics if the index passed is out of range: New lines must be added using Scoreboard.Add.

func (*Scoreboard) Setf

func (board *Scoreboard) Setf(index int, format string, a ...interface{}) *Scoreboard

Setf sets a line on the scoreboard to a new value passed, formatting the values according to the rules of fmt.Sprintf with a custom format. Setf panics if the index passed is out of range: New lines must be added using Scoreboard.Addf.

Jump to

Keyboard shortcuts

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