com.quartercode.quarterbukkit.api.scheduler
Class ScheduleTask

java.lang.Object
  extended by com.quartercode.quarterbukkit.api.scheduler.ScheduleTask
All Implemented Interfaces:
java.lang.Runnable

public abstract class ScheduleTask
extends java.lang.Object
implements java.lang.Runnable

This class is for implementing an easy to use schedule-task fir the Bukkit-Scheduler.


Constructor Summary
ScheduleTask(org.bukkit.plugin.Plugin plugin)
          Creates a schedule task with a custom Plugin.
 
Method Summary
 ScheduleTask add(java.util.Collection<ScheduleTask> collection)
          Adds the schedule task to a Collection (this may be a ScheduleGroup).
 ScheduleTask cancel()
          Cancels this schedule task.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isRunning()
          Returns if the ScheduleTask is running.
 ScheduleTask run(boolean sync, long delay)
          Runs the scheduler once with a delay.
 ScheduleTask run(boolean sync, long delay, long period)
          Runs the scheduler repeating with a delay until it's cancelled.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

ScheduleTask

public ScheduleTask(org.bukkit.plugin.Plugin plugin)
Creates a schedule task with a custom Plugin. This is recommended!

Parameters:
plugin - The custom plugin.
Method Detail

isRunning

public boolean isRunning()
Returns if the ScheduleTask is running. Check this before run() or cancel()!

Returns:
If the ScheduleTask is running.

add

public ScheduleTask add(java.util.Collection<ScheduleTask> collection)
Adds the schedule task to a Collection (this may be a ScheduleGroup).

Parameters:
collection - The Collection to add the task.
Returns:
This schedule task.

run

public ScheduleTask run(boolean sync,
                        long delay)
Runs the scheduler once with a delay. You have to cancel it after running.

Parameters:
sync - Should the scheduler runs synced with the Bukkit-Main-Thread. Async tasks are deprecated!
delay - The delay in ticks.
Returns:
This schedule task.

run

public ScheduleTask run(boolean sync,
                        long delay,
                        long period)
Runs the scheduler repeating with a delay until it's cancelled.

Parameters:
sync - Should the scheduler runs synced with the Bukkit-Main-Thread. Async tasks are deprecated!
delay - The delay in ticks.
period - The delay between two repeatings in ticks.
Returns:
This schedule task.

cancel

public ScheduleTask cancel()
Cancels this schedule task.

Returns:
This schedule task.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object