Package de.eimmer.zeitplaner
Class EimmerAblaufbar
java.lang.Object
de.eimmer.zeitplaner.EimmerAblaufbar
- All Implemented Interfaces:
Runnable
This class is provided as an easy way to handle scheduling tasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Attempts to cancel this task.int
Gets the task id for this runnable.boolean
Returns true if this task has been cancelled.runTask
(Zusatzmodul zusatzmodul) Schedules this in the Bukkit zeitplaner to run on next tick.runTaskAsynchronously
(Zusatzmodul zusatzmodul) Asynchronous tasks should never access any API in Eimmer.runTaskLater
(Zusatzmodul zusatzmodul, long delay) Schedules this to run after the specified number of server ticks.runTaskLaterAsynchronously
(Zusatzmodul zusatzmodul, long delay) Asynchronous tasks should never access any API in Eimmer.runTaskTimer
(Zusatzmodul zusatzmodul, long delay, long period) Schedules this to repeatedly run until cancelled, starting after the specified number of server ticks.runTaskTimerAsynchronously
(Zusatzmodul zusatzmodul, long delay, long period) Asynchronous tasks should never access any API in Eimmer.
-
Constructor Details
-
EimmerAblaufbar
public EimmerAblaufbar()
-
-
Method Details
-
isCancelled
Returns true if this task has been cancelled.- Returns:
- true if the task has been cancelled
- Throws:
IllegalStateException
- if task was not scheduled yet
-
cancel
Attempts to cancel this task.- Throws:
IllegalStateException
- if task was not scheduled yet
-
runTask
@NotNull public EimmerAufgabe runTask(@NotNull Zusatzmodul zusatzmodul) throws IllegalArgumentException, IllegalStateException Schedules this in the Bukkit zeitplaner to run on next tick.- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling task- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
runTaskAsynchronously
@NotNull public EimmerAufgabe runTaskAsynchronously(@NotNull Zusatzmodul zusatzmodul) throws IllegalArgumentException, IllegalStateException Asynchronous tasks should never access any API in Eimmer. Great care should be taken to assure the thread-safety of asynchronous tasks.Schedules this in the Bukkit zeitplaner to run asynchronously.
- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling task- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
runTaskLater
@NotNull public EimmerAufgabe runTaskLater(@NotNull Zusatzmodul zusatzmodul, long delay) throws IllegalArgumentException, IllegalStateException Schedules this to run after the specified number of server ticks.- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling taskdelay
- the ticks to wait before running the task- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
runTaskLaterAsynchronously
@NotNull public EimmerAufgabe runTaskLaterAsynchronously(@NotNull Zusatzmodul zusatzmodul, long delay) throws IllegalArgumentException, IllegalStateException Asynchronous tasks should never access any API in Eimmer. Great care should be taken to assure the thread-safety of asynchronous tasks.Schedules this to run asynchronously after the specified number of server ticks.
- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling taskdelay
- the ticks to wait before running the task- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
runTaskTimer
@NotNull public EimmerAufgabe runTaskTimer(@NotNull Zusatzmodul zusatzmodul, long delay, long period) throws IllegalArgumentException, IllegalStateException Schedules this to repeatedly run until cancelled, starting after the specified number of server ticks.- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling taskdelay
- the ticks to wait before running the taskperiod
- the ticks to wait between runs- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
runTaskTimerAsynchronously
@NotNull public EimmerAufgabe runTaskTimerAsynchronously(@NotNull Zusatzmodul zusatzmodul, long delay, long period) throws IllegalArgumentException, IllegalStateException Asynchronous tasks should never access any API in Eimmer. Great care should be taken to assure the thread-safety of asynchronous tasks.Schedules this to repeatedly run asynchronously until cancelled, starting after the specified number of server ticks.
- Parameters:
zusatzmodul
- the reference to the zusatzmodul scheduling taskdelay
- the ticks to wait before running the task for the first timeperiod
- the ticks to wait between runs- Returns:
- a EimmerAufgabe that contains the id number
- Throws:
IllegalArgumentException
- if zusatzmodul is nullIllegalStateException
- if this was already scheduled- See Also:
-
getTaskId
Gets the task id for this runnable.- Returns:
- the task id that this runnable was scheduled as
- Throws:
IllegalStateException
- if task was not scheduled yet
-