Cancel bukkit runnable

Discussion in 'Plugin Development' started by HackintoshMan, May 10, 2013.

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

    HackintoshMan

    I have tried to use cancel(), but his can I cancel the countdown of my bukkit runnable method?
     
  2. Offline

    chasechocolate

    Code:java
    1. this.cancel();
     
  3. Offline

    HackintoshMan

    chasechocolate
    It just asks me if I want to create the method cancel…
     
  4. Offline

    chasechocolate

  5. Im sorry to bring up an old thread but I have the same problem.
    Here is my code.
    Code:java
    1. BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    2. scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {
    3. private int tmp = 0;
    4. @Override
    5. public void run() {
    6. tmp++;
    7. if(tmp == 6){
    8. this.cancel();
    9. }
    10. }
    11. }, 0L, 20L);

    It asks me to create a new method
     
  6. Offline

    Sagacious_Zed Bukkit Docs

    Jack Price-Burns Please pay attention to the type hierarchy. A BukkitRunnable is a Runnable but a Runnable is not always a BukkitRunnable.
     
  7. Sagacious_Zed Oh okay, how would I achieve the same goal of something running every 20 ticks until I stop it using BukkitRunnable?
     
  8. Offline

    Sagacious_Zed Bukkit Docs

Thread Status:
Not open for further replies.

Share This Page