Scoreboard Issues

Discussion in 'Plugin Development' started by SpongyBacon, Oct 31, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    SpongyBacon

    Hey,
    My scoreboard doesn't seem to want to work as it should.
    It's updating fine, but it fucked up the spacing (should be like it is at the top), and the votes line doesn't even appear >_>
    [​IMG]

    My update code (Everything scoreboard)
    http://pastebin.com/GGg8RJ5t

    Code:
    public void updateSb(Player p) {
                    sb = Bukkit.getScoreboardManager().getNewScoreboard();
                    o = sb.registerNewObjective("test", "dummy");
                 
                    o.setDisplayName(ChatColor.BLUE + "SCOREBOARD");
                    o.setDisplaySlot(DisplaySlot.SIDEBAR);
                 
                    votesB = o.getScore("" + votes);
                    votesB.setScore(-4);
                    Score votesA = o.getScore(ChatColor.AQUA + "Votes / 250");
                    votesA.setScore(-3);
                 
                    Score line2 = o.getScore("");
                    line2.setScore(-2);
                 
                    //String groups = perms.getPlayerGroups(p).toString();
                    warpB = o.getScore("/warp <rank>");
                    warpB.setScore(-1);
                    Score warpA = o.getScore(ChatColor.AQUA + "Mine Warp");
                    warpA.setScore(0);
                 
                    Score line5 = o.getScore("");
                    line5.setScore(1);
                 
                    int broke;
                 
                    try {
                            broke = broken.get(p.getUniqueId());
                    } catch (NullPointerException e) {
                            broke = 0;
                    }
                 
                    minedB = o.getScore("" + broke);
                    minedB.setScore(2);
                    Score minedA = o.getScore(ChatColor.AQUA + "Blocks Mined");
                    minedA.setScore(3);
                 
                    Score line8 = o.getScore("");
                    line8.setScore(4);
                 
                    int online = getServer().getOnlinePlayers().length;
                    onlineB = o.getScore("" + online);
                    onlineB.setScore(5);
                    Score onlineA = o.getScore(ChatColor.AQUA + "Online Now");
                    onlineA.setScore(6);
                 
                    Score line11 = o.getScore("");
                    line11.setScore(7);
                 
                    double balance = eco.getBalance(p.getName());
                    balanceB = o.getScore(balance + "");
                    balanceB.setScore(8);
                    Score balanceA = o.getScore(ChatColor.AQUA + "Balance");
                    balanceA.setScore(9);
                 
                    p.setScoreboard(sb);
            }
     
  2. Offline

    TheCodingCat

    you cant use a blank score twice. That is like saying im going to put player "Bob" twice. A trick you can use is to add a chatcolor plus "" and use different codes to make it work
     
  3. Offline

    SpongyBacon

    Wow, as simple as that :(

    Thanks alot man!
     
  4. Offline

    TheCodingCat

Thread Status:
Not open for further replies.

Share This Page