Repeating task?

Discussion in 'BungeeCord Plugin Development' started by Inkzzz, Jul 14, 2015.

  1. Inkzzz

    Resource Staff

    Okay, so I'm wanting to call a repeating task.

    Code:
    Code (Text):
        public void globalboostertimer(final Booster booster) {
            Main.getInstance().getProxy().getScheduler()
                    .schedule(Main.getInstance(), new Runnable() {
                        public void run() {
                                if (booster.getTime() >= 1) {
                                    booster.setTime(booster.getTime() - 1);
                                } else {
                                    globalboosterFinish(booster);
                            }
                        }
                    }, booster.getTime() , TimeUnit.SECONDS);
        }

     
    booster.getTime() is 10 as a Integer. It never calls the method globalboosterFinish(booster); ?
    I'm not getting any errors?

    Thanks.
     
  2. Teg

    Teg
    Supporter

    You didn't schedule a repeating task, you scheduled a delayed task. A repeating task's arguments are plugin instance, runnable, start delay, run interval, and time unit. You didn't give a run interval.
     
  3. Inkzzz

    Resource Staff

    Oh, thanks!