scoreboard

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 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. Scoreboard implements the io.Writer and io.StringWriter interfaces. fmt.Fprintf and fmt.Fprint may be used to write formatted text to the scoreboard.

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

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

Lines returns the data of the Scoreboard as a slice of strings.

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)

Remove removes a specific line from the scoreboard. Remove panics if the index passed is negative or 15+.

func (*Scoreboard) Set

func (board *Scoreboard) Set(index int, s string)

Set changes a specific line in the scoreboard and adds empty lines until this index is reached. Set panics if the index passed is negative or 15+.

func (*Scoreboard) Write

func (board *Scoreboard) Write(p []byte) (n int, err error)

Write writes a slice of data as text to the scoreboard. Newlines may be written to create a new line on the scoreboard.

func (*Scoreboard) WriteString

func (board *Scoreboard) WriteString(s string) (n int, err error)

WriteString writes a string of text to the scoreboard. Newlines may be written to create a new line on the scoreboard.

Jump to

Keyboard shortcuts

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