Scoreboard (Below Name)

Discussion in 'Spigot Plugin Development' started by Inkzzz, Jun 21, 2015.

  1. Inkzzz

    Resource Staff

    why does this occur when setting a display name for a scoreboard under the players name?
    It's the random '0'


    Thanks in advance.
  2. Code? That will most likely never happen for someone else, so not snippets of code that you think will be useful, if you can as much code so we can sort of try to get a feeling of what's going on when that scoreboard is being set etc... And don't worry many people have set a scoreboard in code before so I don't think anyone's code is going to be original anymore, even mine is based off of forums
  3. Inkzzz

    Resource Staff

    Code (Text):
        public Scoreboard drawBoard(Player p) {
            Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
            Team team = board.registerNewTeam("online");
            Objective obj = board.registerNewObjective("dummy", "test");

            obj.setDisplayName(ChatColor.RED + "Health" + ChatColor.GRAY + ": "
                    + (int) p.getHealth());

            return board;
  4. Omg... Your setting the title to Health: p.getHealth() the zero is the dummy score that is required for that scoreboard to be shown, set the title to Health and set the score to p.getHealth()

    Edit: I meant omg as in it took me so long to find it xD
  5. Inkzzz

    Resource Staff

    So? [​IMG]
  6. you created the dummy variable, you set the dummy variable title to Health, but the dummy variable score is still at 0 (hence why you have a big 0 at the front) unfortunately the score cannot be displayed after the Health but then you SET the score to the players health you do NOT get the score the code you have is still setting the score to 0
  7. sothatsit


    You can not get rid of the "0" you just have to set that to the players health and set the display name to Health and it will be "0 health". Then set the players score to the players health.
    • Like Like x 1
  8. Inkzzz

    Resource Staff