Scoreboard bug

Discussion in 'Spigot Plugin Help' started by Yekllurt, Jun 8, 2015.

  1. Hi guys im having some iusses with the scoreboard below the player name.
    It shows the scoreboard on a different player then it should.
    So i if set it for Yekllurt it shows on Paul for example, how do i fix that ?
    Here is my code, I update it during the player move event I know it's not good for the performence.
    If you have any ideas just write them in the comments.
    Im thankfull for all the help!

    Code (Text):
    public void update() throws SQLException{
       
            for(Player p : Bukkit.getOnlinePlayers()){
               
                if(Guild.isInAnyGuild(p.getUniqueId())){
                   
                     ScoreboardManager manager = Bukkit.getScoreboardManager();
                     Scoreboard board = manager.getNewScoreboard();
                     Objective objective = board.registerNewObjective("tag", "dummy");
                     objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
                     objective.setDisplayName(Guild.getGuildFromPlayer(p.getUniqueId()));
                     p.setScoreboard(board);
                   
                }else{
                   
                    p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
                   
                }
            }
           
        }