java - How to stop a repeating task schedule in Bukkit -
i writing minigame minecraft , have problem schedule. don't know how stop schedule. please tell me how can stop running loop / timer / schedule:
public void wartetimer() { count = bukkit.getscheduler().schedulesyncrepeatingtask( (plugin) this, new runnable() { @override public void run() { if (countdown > 0) { bukkit.broadcastmessage("§6countdown : " +countdown); countdown--; } else { game(); //bukkit.getscheduler().canceltask(count); //countdown = 5; } } }, 0l, 20l); }
to stop scheduler in bukkit have id scheduler , call bukkit scheduler cancel method.
i see have set count
equal scheduler. assuming count
integer.
to stop scheduler put:
bukkit.getscheduler().canceltask(taskid);
in case use :
bukkit.getscheduler().canceltask(count);
you can run line ever , stop scheduler.
Comments
Post a Comment