Class TurtleCommandResult

java.lang.Object
dan200.computercraft.api.turtle.TurtleCommandResult

public final class TurtleCommandResult extends Object
Used to indicate the result of executing a turtle command.
See Also:
  • Method Details

    • success

      public static TurtleCommandResult success()
      Create a successful command result with no result.
      Returns:
      A successful command result with no values.
    • success

      public static TurtleCommandResult success(@Nullable Object[] results)
      Create a successful command result with the given result values.
      Parameters:
      results - The results of executing this command.
      Returns:
      A successful command result with the given values.
    • failure

      public static TurtleCommandResult failure()
      Create a failed command result with no error message.
      Returns:
      A failed command result with no message.
    • failure

      public static TurtleCommandResult failure(@Nullable String errorMessage)
      Create a failed command result with an error message.
      Parameters:
      errorMessage - The error message to provide.
      Returns:
      A failed command result with a message.
    • isSuccess

      public boolean isSuccess()
      Determine whether the command executed successfully.
      Returns:
      If the command was successful.
    • getErrorMessage

      @Nullable public String getErrorMessage()
      Get the error message of this command result.
      Returns:
      The command's error message, or null if it was a success.
    • getResults

      @Nullable public Object[] getResults()
      Get the resulting values of this command result.
      Returns:
      The command's result, or null if it was a failure.