Solved Scoreboard Bug

Discussion in 'Spigot Plugin Development' started by xSinclare, Mar 13, 2017.

Thread Status:
Not open for further replies.
  1. Hey, Spigot! I happen to be having a minor issue with my scoreboard even. There's basically suppose to be a line under the display name and a line break after where the rank is shown, but that, unfortunately, isn't happening. Here is a screenshot how it currently looks:

    [​IMG]

    And here's the code (some parts edited out due to privacy reasons):

    Code (Text):
    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Core.plugin, () -> {

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

                objective.setDisplaySlot(DisplaySlot.SIDEBAR);
                objective.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "[DISPLAY NAME]");

                Score score = objective.getScore(ChatColor.GRAY + "" + ChatColor.BOLD + "" + ChatColor.STRIKETHROUGH + "----------------");
                score.setScore(10);

                Score score1 = objective.getScore(ChatColor.GOLD + "RANK:");
                score1.setScore(9);

                Score score2 = objective.getScore(RankUtils.getRankPlayer(UUID).getTagWithBrackets(true));
                score2.setScore(8);

                Score score3 = objective.getScore(ChatColor.RESET.toString());
                score3.setScore(7);

                Score score4 = objective.getScore(ChatColor.GOLD + "HEALTH:");
                score4.setScore(6);

                long health = Math.round(p.getHealth());

                Score score5 = objective.getScore(ChatColor.GRAY + String.valueOf(health));
                score5.setScore(5);

                Score score6 = objective.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
                score6.setScore(4);

                Score score7 = objective.getScore(ChatColor.GOLD + "SPAWN:");
                score7.setScore(3);

                Score score8 = objective.getScore(ChatColor.GRAY + "-23, 63, -210");
                score8.setScore(2);

                Score score9 = objective.getScore(ChatColor.GRAY + "" + ChatColor.BOLD + "" + ChatColor.STRIKETHROUGH + "----------------");
                score9.setScore(1);

                p.setScoreboard(board);

            },0, 20 * 10);
    Any and all help is appreciated!
     
  2. add some spaces to your score3.
     
  3. If I can state anything, it would be that the part 10-7 is offset, the "Rank:" should be 9 not 10, the actual rank should be 8, not 9. \
    EDIT: Possibly you have something else that you forgot about controlling it
     
  4. Try adding a unique chatcolor to the front of the score value, example:

    ChatColor.RED + ""+ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "----------------"
    ChatColor.BLUE + "" +ChatColor.GRAY +"" + ChatColor.STRIKETHROUGH + "----------------"
     
  5. Each score needs to be Unique. Thats why the line is not showing up.
     
  6. This worked. Thank you! My scoreboard looks just dandy now :D (Shall now be marked as Resolved and Locked)
    [​IMG]
     
    • Like Like x 1
Thread Status:
Not open for further replies.