Util Scoreboards without flashing on refresh (class)

Discussion in 'Resources' started by SpongyBacon, Apr 18, 2015.

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


    This enables you to refresh your scoreboard without it flashing.

    It should acheive this effect w/o any packet modification!

    1. Paste into a new class in your project.
    2. Include this class in your constructor(s).
    3. Configure all the names & settings.
    4. Use addPlayer(player) to add them to the scoreboard.
    5. Use refresh() to update the values.

    PLEASE NOTE: This is just a working implementation of other people's code and ideas :) If you use this for a Github repo, maybe provide a link? <3

    - Wolvereness - the idea. http://sbnc.khobbits.co.uk/log/logs/old/bukkitdev_[2014-06-09].htm
    - @fireblast709 - providing some sample code. https://bukkit.org/threads/update-a-scoreboard-every-second-without-flashing.288265/

    The class - http://pastebin.com/u7bYnVR4
    package me.package.test;
    import org.bukkit.entity.Player;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;
    import org.bukkit.scoreboard.Team;
    // Credit: http://spongybacon.com/scoreboards
    public class Scoreboards {
        private ScoreboardManager manager;
        private Scoreboard board;
        private Team team;
        private Objective o;
        private Objective buffer;
        private Objective t;
        public Scoreboards() {
            // Setting up all the scoreboard variables
            this.manager = plugin.getServer().getScoreboardManager();
            this.board = manager.getNewScoreboard();
            this.team = board.registerNewTeam("team");
            // Two objectives for buffer & normal
            this.o = board.registerNewObjective("test", "dummy");
            this.buffer = board.registerNewObjective("buffer", "dummy");
            // Setting up the scoreboard display stuff
        public void setScore(String name, int score) {
            // First you update the buffer
            // Then you tell the scoreboard to use the buffer
            // and swap the variables for our convenience
            // And update the -what used to be objective- buffer
        public void swapBuffer() {
            // Simply change the slot, the scoreboard will now
            // push all updating packets to the player
            // Thus wasting not a single ms on executing this at
            // a later time
            // Simply changing references for naming convenience
            t = o;
            o = buffer;
            buffer = t;
        // A simple method to set the scores again, and therefore refresh it.
        public void refresh() {
            setScore("Red Team", Scores.redScore);
            setScore("Blue Team", Scores.blueScore);
        // Adding the player to the scoreboard
        public void addPlayer(Player p) {
        // Removing the player from the scoreboard
        public void removePlayer(Player p) {
    If you need help, reply here or shoot me a private message!
    Last edited: Apr 19, 2015
  2. Offline


    Many people will find this horribly useful.
    *Meaning awesomely useful
    SpongyBacon likes this.
  3. Offline



    Thanks for this method but I seem to have an issue. When I implemented the buffer system to stop the flashy scoreboard, I can't seem to add more than 1 score. The rest would not show. What seems to be the problem? Here are my 2 classes:



    It still flashes.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Dec 1, 2015
  4. Offline


    @T0pAz7 Looks like an issue with your modifications. Try it without your CustomScore object.
  5. Offline


    @SpongyBacon I got to stop the flashing by replacing it with team prefixes and suffixes. But there is a character limit. Anyway I use that example and when I setScore, it duplicates the values. Is there a way to fix it without resetting scores since it is what causes the flashing issue.
  6. hello i have a problem,

    setScore("Red Team", Scores.redScore);
    setScore("Blue Team", >>>>>>>Scores<<<<<<<<<<.blueScore);
    Scores <-------- IS REDLINED what is the problem?¿
  7. Offline

    timtower Administrator Moderator

    @PistoFrancoPuumm Wild guess: are you calling something in a static way that doesn't exist?
  8. y think yes
  9. Offline

    Mrs. bwfctower

Thread Status:
Not open for further replies.

Share This Page