# Scoreboards

## Creating

For starting, you need to create scoreboard.

For example, you can use this method:

```java
public void createScoreboard(Player player) {
    HScoreboard scoreboard = HCore.createScoreboard(player, "id"); // we created a HScoreboard object for player with id "id"

    scoreboard.setTitle("Scoreboard"); //sets title of scoreboard
    scoreboard.expire(10, TimeUnit.MINUTES); //this scoreboard will delete in 10 minutes
    scoreboard.show(); //this will shows scoreboard to player

    scoreboard.update(2, hScoreboard -> { //every 2 tick, this consumer runs and automaticly will run show method.
        scoreboard.setLine(0, "test"); //sets line 0 of scoreboard as "test"
        scoreboard.setLine(1, "this is a test scoreboard"); //sets line 1 of scoreboard as "this is a test scoreboard"
        scoreboard.setLine(2, "this is 3th line of scoreboard!");
    });
}
```

## HScoreboard#delete()

WIll delete the scoreboard.

## HScoreboard#getPlayer()

Returns player which have this scoreboard.

## HScoreboard#setTitle(String title)

Changes the title of scoreboard.

## HScoreboard#setLine(int line, String content)

Changes the provided line by number to new content.

## HScoreboard#setLines(String... lines)

Changes full content of scoreboard to provided.

## HScoreboard#expire(int ticks)

Scoreboard will be automatically deleted after provided ticks. 1 second = 20 ticks.

## HScoreboard#update(int interval, Consumer\<HScoreboard> consumer)

Scoreboard will be automatically call provided consumer with provided interval in ticks.

## HScoreboard#show()

Shows the scoreboard to player.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hcore.gitbook.io/wiki/messaging/scoreboards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
