Interface Task.Builder
- All Superinterfaces:
- AbstractBuilder<Task>,- Builder<Task,,- Task.Builder> - CopyableBuilder<Task,,- Task.Builder> - ResettableBuilder<Task,- Task.Builder> 
- Enclosing interface:
- Task
Task.- 
Method SummaryModifier and TypeMethodDescriptionbuild()Builds the task.default Task.Builderdelay(long delay, TemporalUnit unit) Sets the delay before the task runs.default Task.BuilderSets the delay before the task runs.Sets the delay before the task runs.Sets the delay before the task runs, inTicks.default Task.BuilderSets theRunnableto run when this task executes.execute(Consumer<ScheduledTask> executor) Sets the consumer that runs when this task executes.default Task.Builderinterval(long interval, TemporalUnit unit) Sets the interval between repetitions of the task.default Task.BuilderSets the interval between repetitions of the task.Sets the interval between repetitions of the task.Sets the interval in unit ticks between repetitions of the task.plugin(org.spongepowered.plugin.PluginContainer plugin) Sets the plugin of the task.Methods inherited from interface org.spongepowered.api.util.CopyableBuilderfrom
- 
Method Details- 
executeSets theRunnableto run when this task executes.- Parameters:
- runnable- The actual task to run
- Returns:
- This builder, for chaining
 
- 
executeSets the consumer that runs when this task executes.- Parameters:
- executor- The executor to run
- Returns:
- This builder, for chaining
 
- 
delaySets the delay before the task runs. This delay is an initial offset, subsequent runs (when the interval is not 0) will not be offset. By default, the delay is 0.- Parameters:
- delay- The delay in the given- TemporalUnit
- unit- The unit the delay is in
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the delay is below 0
 
- 
delaySets the delay before the task runs. This delay is an initial offset, subsequent runs (when the interval is not 0) will not be offset. By default, the delay is 0.- Parameters:
- delay- The delay in the given- TimeUnit
- unit- The unit the delay is in
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the delay is below 0
 
- 
delaySets the delay before the task runs, inTicks.- Parameters:
- ticks- The delay in ticks
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the delay is below 0 or infinite
 
- 
delaySets the delay before the task runs. This delay is an initial offset, subsequent runs (when the interval is not 0) will not be offset. By default, the delay is 0.- Parameters:
- delay- The delay duration
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the delay duration is below 0
 
- 
intervalSets the interval between repetitions of the task. The task will not repeat if the interval is 0. By default, the interval is 0.If the scheduler detects that two tasks will overlap, the 2nd task will not be started. The next time the task is due to run, the test will be made again to determine if the previous occurrence of the task is still alive (running). As long as a previous occurrence is running no new occurrences of that specific task will start, although the scheduler will never cease in trying to start it a 2nd time. - Parameters:
- interval- The interval duration
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the interval is below 0
 
- 
intervalSets the interval between repetitions of the task. The task will not repeat if the interval is 0. By default, the interval is 0.If the scheduler detects that two tasks will overlap, the 2nd task will not be started. The next time the task is due to run, the test will be made again to determine if the previous occurrence of the task is still alive (running). As long as a previous occurrence is running no new occurrences of that specific task will start, although the scheduler will never cease in trying to start it a 2nd time. - Parameters:
- interval- The interval in the given- TemporalUnit
- unit- The unit the interval is in
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the interval is below 0
 
- 
intervalSets the interval between repetitions of the task. The task will not repeat if the interval is 0. By default, the interval is 0.If the scheduler detects that two tasks will overlap, the 2nd task will not be started. The next time the task is due to run, the test will be made again to determine if the previous occurrence of the task is still alive (running). As long as a previous occurrence is running no new occurrences of that specific task will start, although the scheduler will never cease in trying to start it a 2nd time. - Parameters:
- interval- The interval in the given- TimeUnit
- unit- The unit the interval is in
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the interval is below 0
 
- 
intervalSets the interval in unit ticks between repetitions of the task.- Parameters:
- ticks- The- Ticksbetween runs.
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the interval is below 0 or infinite
 
- 
pluginSets the plugin of the task.- Parameters:
- plugin- The plugin instance
- Returns:
- This builder, for chaining
- Throws:
- IllegalArgumentException- If the given object isn't a valid plugin
 
- 
buildTask build()Builds the task.- Specified by:
- buildin interface- AbstractBuilder<Task>
- Returns:
- A new instance of a Task
- Throws:
- IllegalStateException- If the- execute(Runnable)isn't set or in the case that- plugin(PluginContainer)isn't set.
 
 
-