How to make count up scoreboard

Discussion in 'Spigot Plugin Development' started by iTweakz, Apr 23, 2017.

  1. So how to make count up scoreboard with java? When you execute command "/countup" you get scoreboard where is count up like 00:01, 00:02, 00:03 etc. When you execute "/countup clear" that clear time and wipe your scoreboard.
     
  2. What have you even tried?
     
  3. I try to make scoreboard with countup.
     
    • Funny Funny x 1
  4. I know. But what have you tried in code?
     
  5. That is all what I got:
    Code (Text):
    public class MatchTimer extends BukkitRunnable {
        private int time;
        public static boolean paused;
       
        public void timer() {
            this.runTaskTimer(Main.getPlugin(Main.class), 0, 20);
            System.out.println("[email protected]");
        }
       
        public static void setPaused(boolean value) {
            paused = value;
        }

        @Override
        public void run() {
            if (!paused) {
                System.out.println("[email protected]");
                if (time != 0) {
                     time++;
                     System.out.println(time);
                }
                System.out.println("not paused");
            } else {
                System.out.println("paused");
            }
        }
    }
     
  6. What you have to do is now update the scoreboard with the time.

    You can either use advanced and use teams > https://www.spigotmc.org/wiki/making-scoreboard-with-teams-no-flicker/#wikiContent

    Or use basic and use scores. https://bukkit.org/threads/tutorial-scoreboards-teams-with-the-bukkit-api.139655/