Scoreboards
hCore also provides you to create your custom scoreboard.
Creating
For starting, you need to create scoreboard.
For example, you can use this method:
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.
Last updated