Interface CommandResult

public interface CommandResult
Represents the result of a command in Sponge.
  • Method Details

    • builder

      static CommandResult.Builder builder()
      Creates a builder that creates CommandResults.
      The CommandResult.Builder
    • success

      static CommandResult success()
      Builds a result that indicates success (where CommandResult.Builder.result(int) is set to 1.

      Note that a successful result is one where the command has done what is expected of it. This should be used in place of "empty" from previous API iterations. If an error condition should be reported, use error(Component) instead, which will allow the system to react accordingly.

      The CommandResult
    • error

      static CommandResult error(Component errorMessage)
      Builds an empty result that will prompt the command manager to send an error message without throwing an exception.
      errorMessage - The error message to send
      The CommandResult
    • isSuccess

      boolean isSuccess()
      Gets whether the command executed successfully.
      true if so.
    • result

      int result()
      Gets the integer result returned by the command that executed.
      The result.
    • errorMessage

      Optional<Component> errorMessage()
      If present, returns the error message associated with this result.
      The error Component