Interface NeedsNameBuilderStage
public interface NeedsNameBuilderStage
A stage in a command builder where requirements and main command execution logic have been set.
No more changes to requirements or command implementation may happen after this point. This is
the final step in command creation
-
Method Summary
Modifier and TypeMethodDescriptionCreates the command based on the options set during previous builder stages.until(BooleanSupplier endCondition) Optionally sets an end condition for the command.whenCanceled(Runnable onCancel) Optionally sets a callback to execute when the command is canceled.withPriority(int priority) Sets the priority level of the command.
-
Method Details
-
whenCanceled
Optionally sets a callback to execute when the command is canceled. The callback will not run if the command was canceled after being scheduled but before starting to run, and will not run if the command completes naturally or from encountering an unhandled exception.- Parameters:
onCancel- The function to execute when the command is canceled while running. May be null.- Returns:
- This builder object, for chaining
-
withPriority
Sets the priority level of the command.- Parameters:
priority- The desired priority level.- Returns:
- This builder object, for chaining.
-
until
Optionally sets an end condition for the command. If the end condition returnstruebefore the command body set inNeedsExecutionBuilderStage.executing(Consumer)would exit, the command will be canceled by the scheduler.- Parameters:
endCondition- An optional end condition for the command. May be null.- Returns:
- This builder object, for chaining.
-
named
Creates the command based on the options set during previous builder stages. The builders will no longer be usable after calling this method.- Parameters:
name- The name of the command- Returns:
- The built command.
- Throws:
NullPointerException- Ifnameis null.
-