BukkitRunnables help

Discussion in 'Plugin Development' started by IcyRelic, Aug 2, 2013.

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

    IcyRelic

    i have this

    Code:
        public boolean spawnZombies(String arena, boolean spawn){
            BukkitTask task = new Zombies(arena, plugin).runTaskLater(plugin, 40);
            task.
            return true;
        }
    and this i got from the bukkit wiki
    Code:
    package me.icyrelic.com.Manager.Arena;
     
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;
     
    public class Zombies extends BukkitRunnable{
     
            private String arena = "";
            private final JavaPlugin plugin;
           
            public Zombies(String arena, JavaPlugin plugin) {
                this.arena = arena;
                this.plugin = plugin;
            }
       
            public void run() {
                // What you want to schedule goes here
                this.plugin.getServer().broadcastMessage("Welcome to Bukkit! Remember to read the documentation!");
            }
       
    }
    
    is there a way instead of to run it later or run now to make it repeat? until i cancel it with task.cancel();

    found this in the docs what is period if it runs until canceled

    BukkitTask runTaskTimer(Plugin plugin, long delay, long period)
    Schedules this to repeatedly run until cancelled, starting after the specified number of server ticks.


    got it working

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page