ConditionalTask

constructor(@NonNull trueTask: Task, @NonNull falseTask: Task, @NonNull conditionOnInit: BooleanSupplier)

Create a new conditional task with the given tasks and condition. Supplied tasks will be reset on init.

Parameters

trueTask

the task to run if the condition is true

falseTask

the task to run if the condition is false

conditionOnInit

the condition to evaluate on initialisation


constructor(@NonNull onTrue: Runnable, @NonNull onFalse: Runnable, @NonNull conditionOnInit: BooleanSupplier)

Create a new conditional task with the given callbacks and condition. Supplied tasks will be reset on init.

Parameters

onTrue

the callback to run if the condition is true

onFalse

the callback to run if the condition is false

conditionOnInit

the condition to evaluate on initialisation


constructor(@NonNull onTrue: Runnable, @NonNull onTrueCallbackName: String, @NonNull onFalse: Runnable, @NonNull onFalseCallbackName: String, @NonNull conditionOnInit: BooleanSupplier)

Create a new conditional task with the given callbacks, task names, and condition. Supplied tasks will be reset on init.

Parameters

onTrue

the callback to run if the condition is true

onTrueCallbackName

the task name of the onTrue callback

onFalse

the callback to run if the condition is false

onFalseCallbackName

the task name of the onTrue callback

conditionOnInit

the condition to evaluate on initialisation