Scoreboard Update

Discussion in 'Spigot Plugin Development' started by WailTosti, Apr 25, 2017.

  1. Why this wouldn't update my scoreboard line 8

    Code (Text):
        new BukkitRunnable()
        {
          public void run()
          {
              Scoreboard b = Bukkit.getScoreboardManager().getNewScoreboard();
              Objective obj = b.registerNewObjective("mainlobby", "dummy");
            Score s8 = obj.getScore(line8);
            s8.setScore(8);
            p.setScoreboard(b);
          }
        }.runTaskTimer(Core.getInstance(), 20L, 5L);
        p.setScoreboard(b);
      }
    }
     
  2. What is
    ?
     
  3. String line8 = ChatUtil.format(fm.getConfig("Scoreboard.yml").get("Scoreboard.Lines.8").replace("%player%", p.getName()).replace("%arrow%", "a->"));
     
  4. You shouldn't create a new scoreboard every time you want to update your scoreboard. Save the scoreboard, then when updating it clear the SIDEBAR and re-add it.
     
  5. Code (Text):
       
       
       
        new BukkitRunnable()
        {
          public void run()
          {
            Score s8 = obj.getScore(line8);
            s8.setScore(8);
            p.setScoreboard(b);
          }
        }.runTaskTimer(Core.getInstance(), 20L, 5L);
        p.setScoreboard(b);
      }
    }


    Like this. But this doesn't work
     
  6. Take a look at my Wiki (See signature) for updating scoreboard and no flicker scoreboard.
     
    #6 TheBlackTeddy, Apr 25, 2017
    Last edited: Apr 25, 2017
    • Agree Agree x 1