1.8.8 Scoreboard doesn't works

Discussion in 'Spigot Plugin Development' started by erikgamer07, Mar 24, 2020.

  1. Hello! I'm making a minigame, and now I'm making the scoreboard.
    The problem is that sometimes, the scoreboard doesn't put the line. I have put debugs and all, the code is running, but I don't know what is happening. This is the code:

    Code (Java):
        public void setupScoreboard(Player p) {

            boards.get(p).destroy();
            boards.remove(p, boards.get(p));

            ScoreboardSign sb = new ScoreboardSign(p, ChatAPI.cc("&5&lEGGWARS"));

            sb.create();
            sb.setLine(0, ChatAPI.cc("&7 "));

            int i = 1;

            for(String registered : getRegisteredTeams()) {

                for (Teams teamss : teams) {

                    if(teamss.getName().equalsIgnoreCase(registered)) {

                        // HERE I SET THE LINEsb.setLine(i, ChatAPI.cc(" &a" + tick + "&" + teamss.getColor() + " " + teamss.getName() + "&7 (" + teamss.getPlayers().size() + ")"));
                        scoreboardpositions.put(teamss.getName(), i);
                        Bukkit.broadcastMessage(teamss.getName()); // HERE IS THE DEBUG
                        i++;
                    }
                }
            }
            int s = i + 1;
            int s2 = s + 1;
            int s3 = s2 + 1;
            int s4 = s3 + 1;
            int s5 = s4 + 1;

            sb.setLine(s, ChatAPI.cc("&8 "));
            sb.setLine(s2, ChatAPI.cc(" &fKills:&a " + kills.get(p)));
            sb.setLine(s3, ChatAPI.cc(" &fDeaths:&a " + deaths.get(p)));
            sb.setLine(s4, ChatAPI.cc("&9 "));
            sb.setLine(s5, ChatAPI.cc("&e     ip"));

            scoreboardpositions.put("kills", s2);
            scoreboardpositions.put("deaths", s3);

            boards.put(p, sb);

        }
    }
    As you have seen, I have a broadcast, and the plugin broadcasts the team's name: "Blue".
    This sometimes happens and sometimes not, but the most of the times it happen is with the Blue team, I don't know why... Do you see any error in my code? This is urgent… Thanks!
     
    #1 erikgamer07, Mar 24, 2020
    Last edited: Mar 24, 2020
  2. There’s an update scoreboard method try updating it


    Sent from my iPhone using Tapatalk
     
  3. I don't understand.
     
  4. I use this API: https://gist.github.com/zyuiop/8fcf2ca47794b92d7caa
     
  5. There's not a update scoreboard method
     
  6. Scoreboard sb;
    Sb.updatescoreboard(obj);


    Sent from my iPhone using Tapatalk
     
  7. No, That's not the problem. The problem is that sometimes writes the line and other times not