Skip to content

Scoreboard

Hakan Kargın edited this page Jun 2, 2022 · 3 revisions

How To Use

Scoreboard

With this feature you can create scoreboards and shows scoreboards to players without any flick.

Example

public void createScoreboard(Player player) {
    HScoreboard scoreboard = HCore.createScoreboard(player); //we created a HScoreboard object for player

    scoreboard.setTitle("Scoreboard"); //sets title of scoreboard
    scoreboard.expire(10, TimeUnit.MINUTES); //this scoreboard will delete in 10 minutes
    scoreboard.setUpdateInterval(2); //when we use update method, it will recall itself every 2 ticks
    scoreboard.show(); //this will shows scoreboard to player

    scoreboard.update(hScoreboard -> { //every 2 tick, this consumer runs.
        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"
    });
}
Clone this wiki locally