java.lang.Object
dev.sympho.modular_commands.api.command.result.Results

public final class Results extends Object
Utilities for generating results from handlers.
Since:
1.0
Version:
1.0
  • Field Details

    • OK

      public static final CommandSuccess OK
      Result indicating the command executed successfully with no further context.
      See Also:
    • FAIL

      public static final CommandFailure FAIL
      Result indicating the command failed with no further context.
      See Also:
  • Method Details

    • ok

      public static CommandSuccess ok()
      Generates a result indicating the command executed successfully with no further context.
      Returns:
      The generated result.
    • okR

      public static CommandResult okR()
      Alias for ok() that casts to a plain Result to avoid Generics issues.
      Returns:
      The result.
    • okMono

      public static Mono<CommandResult> okMono()
      Generates a result indicating the command executed successfully with no further context.
      Returns:
      A Mono that issues the generated result.
      See Also:
    • fail

      public static CommandFailure fail()
      Generates a result indicating the command failed with no further context.
      Returns:
      The generated result.
    • failR

      public static CommandResult failR()
      Alias for fail() that casts to a plain Result to avoid Generics issues.
      Returns:
      The result.
    • failMono

      public static Mono<CommandResult> failMono()
      Generates a result indicating the command failed with no further context.
      Returns:
      A Mono that issues the generated result.
      See Also:
    • success

      public static CommandSuccessMessage success(String message)
      Generates a result indicating the command executed successfully with a message to the user.
      Parameters:
      message - The message to the user.
      Returns:
      The generated result.
    • successR

      public static CommandResult successR(String message)
      Alias for success(String) that casts to a plain Result to avoid Generics issues.
      Parameters:
      message - The message to the user.
      Returns:
      The result.
    • successMono

      public static Mono<CommandResult> successMono(String message)
      Generates a result indicating the command executed successfully with a message to the user.
      Parameters:
      message - The message to the user.
      Returns:
      A Mono that issues the generated result.
      See Also:
    • failure

      public static CommandFailureMessage failure(String message)
      Generates a result indicating the command failed with a message to the user.
      Parameters:
      message - The message to the user.
      Returns:
      The generated result.
    • failureR

      public static CommandResult failureR(String message)
      Alias for failure(String) that casts to a plain Result to avoid Generics issues.
      Parameters:
      message - The message to the user.
      Returns:
      The result.
    • failureMono

      public static Mono<CommandResult> failureMono(String message)
      Generates a result indicating the command failed with a message to the user.
      Parameters:
      message - The message to the user.
      Returns:
      A Mono that issues the generated result.
      See Also:
    • error

      public static CommandError error(String message)
      Generates a result indicating the command encountered an error.
      Parameters:
      message - The error message.
      Returns:
      The generated result.
    • errorR

      public static CommandResult errorR(String message)
      Alias for error(String) that casts to a plain Result to avoid Generics issues.
      Parameters:
      message - The message to the user.
      Returns:
      The result.
    • errorMono

      public static Mono<CommandResult> errorMono(String message)
      Generates a result indicating the command encountered an error.
      Parameters:
      message - The error message.
      Returns:
      A Mono that issues the generated result.
      See Also:
    • exception

      public static CommandErrorException exception(Throwable cause)
      Generates a result indicating the command encountered an error due to an exception.
      Parameters:
      cause - The exception that caused the error.
      Returns:
      The generated result.
      API Note:
      Exceptions thrown by a command handler are automatically wrapped into an error result. As such, allowing the exception to propagate up is preferrable to explicitly generating the error.
    • exceptionR

      public static CommandResult exceptionR(Throwable cause)
      Alias for exception(Throwable) that casts to a plain Result to avoid Generics issues.
      Parameters:
      cause - The exception that caused the error.
      Returns:
      The result.
    • exceptionMono

      public static Mono<CommandResult> exceptionMono(Throwable cause)
      Generates a result indicating the command encountered an error due to an exception.
      Parameters:
      cause - The exception that caused the error.
      Returns:
      A Mono that issues the generated result.
      See Also: