bukkit scoreboard code example

Example: bukkit scoreboard

ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("test", "dummy");

    //Setting where to display the scoreboard/objective (either SIDEBAR, PLAYER_LIST or BELOW_NAME)
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
     
    //Setting the display name of the scoreboard/objective
    objective.setDisplayName("Display Name");

    Score score = objective.getScore(ChatColor.GREEN + "Kills:"); //Get a fake offline player
    score.setScore(1);

Tags:

Java Example