Solved Run something every second, but something else every 2 seconds.

Discussion in 'Plugin Development' started by Blockhead7360, Aug 28, 2015.

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

    Blockhead7360

    Hello!

    I am making a plugin, and I was wondering how to run one thing every second, but something else every 2 (or another number) seconds. For example: I create a BukkitRunnable spawning a zombie every second. But I also want to spawn a creeper every 2 seconds.

    Does it work if I create 2 BukkitRunnables, one before the other one like this?
    Code:
    new BukkitRunnable(){
            public void run(){
                spawnZombie();
            }
        }.runTaskTimer(this, 0, 1 * 20L);
       
        new BukkitRunnable(){
            public void run(){
                spawnCreeper();
            }
        }.runTaskTimer(this, 0, 2 * 20L);
    I want both of them to be running at the same time.

    Please help, thanks :D
     
  2. Offline

    ShadowRanger

    Yes. Why didn't you just try it out before you posted a thread about it?
     
    Blockhead7360 likes this.
Thread Status:
Not open for further replies.

Share This Page