Repeated Task

Discussion in 'Plugin Development' started by Giovolo, Jul 27, 2021.

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

    Giovolo

    I want to make some code run every 10 ticks in my Commands class (the trigger is in Commands, and i don't know how to move it to Main). I tried using runTaskTimer() and it says that the method is deprecated, although no errors found. Also, i need the task to cancel itself 10 minutes after start.
    This is what i was trying to do:


    Bukkit.getServer().getScheduler().runTaskTimer(Main.getPlugin(Main.class), new BukkitRunnable(){//some code//})

    Any help is appreciated, thanks.

    mods its been 20 hours now

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 28, 2021
  2. Offline

    davidclue

    Code:
    Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, runnable, initialDelay, repeatingDelay);
     
Thread Status:
Not open for further replies.

Share This Page