Scoreboards - JustKato/BukkitWiki GitHub Wiki

How to create a scoreboard

Video guide: Scoreboards

    public static Scoreboard GenerateMainScoreboard() {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();
        Objective objective = board.registerNewObjective("Your Scoreboard Title","dummy");
        objective.setDisplayName("ScoreBoard Title");
        // Where to position the scoreboard, posibilities : 
        // DisplaySlot.SIDEBAR, DisplaySlot.BELOW_NAME, DisplaySlot.PLAYER_LIST
        objective.setDisplaySlot(DisplaySlot.SIDEBAR);

        Score spacee = objective.getScore(" ");
        spacee.setScore(3); // This value represents the number on the right side of the scorboard's name
        // I personally recommend setting them as Name + Value instead of setting the name then setting
        // The score's value, since it's quite limited.

        // Over here we set the player's pocket to 1000
        Score pocket = objective.getScore(ChatColor.GOLD+ "Pocket: 1000"); 
        pocket.setScore(2);

        Score space = objective.getScore("");
        space.setScore(1);

        Score site = objective.getScore(ChatColor.YELLOW + "www.ChunkBytes.com");
        site.setScore(0);

        return board;
    }

Result: Not how the score's value is on the right side counting down.