Scoreboard is stuck to '0'

Discussion in 'Plugin Development' started by Zarkopafilis, Jul 22, 2014.

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

    Zarkopafilis

    I have a virtual levels in the server , stored on the database. I try to present the level of each player but they are stuck with '0' even if their level is higher.

    Code:
    ScoreboardManager manager = Bukkit.getScoreboardManager();
            Scoreboard board = manager.getNewScoreboard();
           
            Objective objective = board.registerNewObjective("level", "dummy");
            objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
            objective.setDisplayName(ChatColor.GREEN + " LEVEL");
           
            for(Player online : Bukkit.getOnlinePlayers()){
              Score score = objective.getScore(online);
              score.setScore(SQLHandler.getLevel(online.getUniqueId()));//get level from database
            }
           
            for(Player online : Bukkit.getOnlinePlayers()){
                online.setScoreboard(board);
            }
     
  2. Offline

    daavko

    Zarkopafilis Try setting the scoreboard for player immediately after setting the score (in the same loop).
     
    Zarkopafilis likes this.
  3. Offline

    fireblast709

  4. Offline

    Zarkopafilis

    Level is not zero , I have tested

    Didn't work either

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    Necrodoom

  6. Offline

    fireblast709

  7. Offline

    Zarkopafilis

  8. Offline

    JaguarJo

Thread Status:
Not open for further replies.

Share This Page