BukkitRunnable counting issue

Discussion in 'Plugin Development' started by Eggspurt, Jul 27, 2015.

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

    Eggspurt

    Code:
            new BukkitRunnable() {
                public void run() {
                    if (cd.contains(player.getName())) {
                        counter++;
                        if (counter == 10) {
                            counter = 0;
                        } 
                    }
                }
            }.runTaskTimer(plugin, 0, 20);
    
    So I have this simple counter to count to 10 then revert back to 0.. But the issue is it seems that it's going a lot faster then 1 second at a time, and it should be 20 ticks = 1 second, am I doing something wrong?


    Thanks
     
  2. Offline

    cfil360

    @Eggspurt Try using 20L rather than just 20.
     
  3. @Eggspurt
    How do you know that the timer is changing that fast? You're not printing the current value or anything.
     
  4. Offline

    Eggspurt

    I spammed my left click button to check the timer in-game here's the outputs

    [​IMG]

    Note this was HOLDING It


    same output
     
  5. @Eggspurt
    Can I see the whole method where you put that code?
     
  6. Offline

    Eggspurt

    That's all of the code the only thing I have is the timer.. What else would you need
     
  7. @Eggspurt
    It could be in some kind of for loop that you didn't know of.
     
Thread Status:
Not open for further replies.

Share This Page