Documentation ¶
Index ¶
- type Scoreboard
- func (board *Scoreboard) Lines() []string
- func (board *Scoreboard) Name() string
- func (board *Scoreboard) Remove(index int)
- func (board *Scoreboard) RemovePadding()
- func (board *Scoreboard) Set(index int, s string)
- func (board *Scoreboard) Write(p []byte) (n int, err error)
- func (board *Scoreboard) WriteString(s string) (n int, err error)
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 ...any) *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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
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) RemovePadding ¶ added in v0.6.0
func (board *Scoreboard) RemovePadding()
RemovePadding removes the padding of one space that is added to the start of every line.
func (*Scoreboard) Set ¶ added in v0.4.0
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.