# Cowboard --- Scoreboard Library
- dynamic line (e.g. countdown)
- scrolling line (with specific width limit)
- static line
- set scores/sorting
- create own board OR use existing one to edit
- flicker-free (with teams and prefixes and suffixes)
# Notes
- possible with Teams and prefixes and suffixes. The score has to have the entry name of the team in it.
- the name of this entry has the maximum length of **20** ChatColor codes.
- this can by any combination of these codes, which means a total of $20^{21}$ possible entry names (that's a lot)
- these entries are scoped to the `Scoreboard` this Objective(slot=SIDEBAR) belongs to. This is because we are using Teams.
```kotlin=
// name of objective is free to choose
// the criteria name is not important, if you change the score yourself
// the displayName is the title of the scoreboard
// the render type is also not important for us
objective = scoreboard.registerNewObjective("name", "criteria", Component.text("Test", NamedTextColor.BLUE), RenderType.INTEGER)
objective.displaySlot = DisplaySlot.SIDEBAR
objective.getScore("§atest1").score = 3
objective.getScore("test2").score = 4
// two scores with the same value is possible.
// ONLY the name has to be unique.
objective.getScore("test").score = 5
objective.getScore("" + ChatColor.GREEN + ChatColor.BLUE).score = 5
```
- what does a Scoreboard contain?
- a list of lines with a maximum amount of lines
- the title
```kotlin=
// `team` is the backend, which will be used to set the text
// via the prefix and suffix.
// If the text.length > 64, we use the suffix as well.
//
// We need one team for each line, because we modify the prefix/suffix for it.
// The name of the team should be unique.
data class Line(val text: String, val score: Int, val team: Team)
```
- at the backend of the cowboard, we store ourselves the `Objective`s.
- the name of the objective has to be unique.
- we can store multiple objectives and each time we want to switch the board at the sidebar, we can just use `objective.displaySlot = DisplaySlot.SIDEBAR`. This means that we can just work with the objective and the underlying `Scoreboard` is of no interest to us.
- we do not want lazy updating.
Example Usage
```kotlin=
val board = Cowboard(Component.text("Title"), player.scoreboard)
.line(Component.text("Rang"))
.line(Component.text("Spieler", NamedTextColor.GREEN))
.blank()
.line(Component.text("Coins"))
.line(Component.text("420.637", NamedTextColor.YELLOW))
.blank()
.line(Component.text("Clan"))
.line(Component.text("Kein Clan", NamedTextColor.AQUA))
.blank()
.line(Component.text("Freunde"))
.line(Component.text("0", NamedTextColor.GREEN).append(Component.text("/21", NamedTextColor.GREY)))
.build()
// ======
// Affecting other views
// ======
// referencing the view
// the methods stay the same.
board.view("keyOfTheView").setLine(3, ...)
// switches to a different view. When switched, the methods above
// will affect the to-switched-to view
board.switchToView("theView")
```
- What do we do with `order` and `score`?
- the score determines the order, but sometimes you want to have a different score -> **no, we dont**, we do not modify the score
- 
- for multiple pages inside one view, we store the current active page
- a page is a list of simple lines, which consist of `name, text, order`