1.8.8 Scoreboard scores messed up

Discussion in 'Spigot Plugin Development' started by Kompye, Mar 22, 2020.

  1. Hello. I have a scoreboard and the scores are in the wrong order and I don't understand why.
    Code (Java):
        public static void setWaitingScoreboard(Player player, Arena arena) {
            Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
            Objective obj = board.registerNewObjective("waitingStats", "dummy");
            obj.setDisplayName(Chat.color("&c&lLucky Mayhem"));
            obj.getScore(" ").setScore(7);
            obj.getScore(Chat.color("&fSe asteapta")).setScore(6);
            obj.getScore("  ").setScore(4);
            obj.getScore(Chat.color("&b" + arena.getWorld().getPlayers().size() + "&7/" + "&b8")).setScore(3);
            obj.getScore("   ").setScore(2);
        public static void updateWaitingScoreboard(Player player, Arena arena) {
            Scoreboard board = player.getScoreboard();
            board.getObjective("waitingStats").getScore(Chat.color("&b" + arena.getWorld().getPlayers().size() + "&7/" + "&b8")).setScore(3);
  2. First of all, I will suggest you to use scoreboard plugins.

    then, a scoreboard cant have same score. try to set them different. I mean, you cant have empy one, more than one.
    But, you can trick it with color codes.

    obj.getScore("§2 ").setScore(2);
    obj.getScore("§4 ").setScore(4);

    And you cant use & in code. Use § instead of it. Press num 2 then 1 theb ENTER while holding ALT for this char. Or, just copy it :p
  3. No, don't do that, what Kompye was doing was utilising ChatColour.translatealternatecolorcodes, which is an acceptable way to do it
    • Like Like x 1
    • Agree Agree x 1
    • Funny Funny x 1
  4. It doesn't have the same score, there is a different number of spaces in each score. Shouldn't this work? Also, I won't use a scoreboard plugin

    Here is a screenshot of what it looks like (bugged): https://imgur.com/a/YU5Bav8
  5. Actually, you cant sure that he uses ChatColor.translateAlternateColorCodes and probably its problem.

    Code (Text):
            Scoreboard board = getServer().getScoreboardManager().getNewScoreboard();
            Objective obj = board.registerNewObjective("waitingStats", "dummy");
            obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&c&lLucky Mayhem"));

            obj.getScore(" ").setScore(7);
            obj.getScore(ChatColor.translateAlternateColorCodes('&', "&fSe asteapta")).setScore(6);
            obj.getScore(ChatColor.translateAlternateColorCodes('&', "&fjucatori...")).setScore(5);
            obj.getScore("  ").setScore(4);
            obj.getScore(ChatColor.translateAlternateColorCodes('&', "&b&7/" + "&b8")).setScore(3);
            obj.getScore("   ").setScore(2);
            obj.getScore(ChatColor.translateAlternateColorCodes('&', "&7mc.etheral.net")).setScore(1);

    Its works for me. I just changed Chat.color to ChatColor.translateAlternateColorCodes


    Cant see your image.


    Heres mine. (deleted arena size stuff)
    • Like Like x 1
    • Funny Funny x 1
  6. Oh, thanks for testing! Though I don't get what is wrong with my util
    Code (Java):
    public class Chat {

        public static String color(String s) {
            return ChatColor.translateAlternateColorCodes('&', s);

  7. As long as it is an unique name it should work!

    Not sure why it is not working on your end though, but in your update scoreboard method there might be a bug. You're creating a new score, but you also have to remove your previous player count line with Scoreboard#resetScores
  8. Im not very interested with scoreboard api.

    I have updated scoreboard with that method, then Its still working

    Then tried to edit score it wont worked :ROFLMAO:
    really you need to delete old one
  9. Removing the update method solves it :/

    But I still need to update
    #9 Kompye, Mar 22, 2020
    Last edited: Mar 22, 2020