Change looped runnable delay time inside of that runnable

Discussion in 'Plugin Development' started by Waif, Feb 24, 2021.

  1. Offline

    Waif

    I have a runnable like this

    new BukkitRunnable()
    {
    @Override
    public void run()
    {

    }
    }.runTaskTimer(Main, 10, 10);

    Instead of 10 in the last argument, I want a variable, which will be changed inside of run() when I need to. Normally I would do that with a final int[] or a static class var, but I have that runnable inside of a for loop. So, I cant pass that there because it will be the same for all runnables created, and I need different for each one.

    Solved the problem by creating a custom class extending bukkit runnable.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 24, 2021

Share This Page