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 Details

    • whenCanceled

      NeedsNameBuilderStage whenCanceled(Runnable onCancel)
      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

      NeedsNameBuilderStage withPriority(int priority)
      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 returns true before the command body set in NeedsExecutionBuilderStage.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

      Command named(String name)
      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 - If name is null.