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