Class ArgumentHandleResult

java.lang.Object
me.efekos.simpler.commands.syntax.ArgumentHandleResult

public class ArgumentHandleResult extends Object
Represents a result you will probably get from Argument.handleCorrection(String). Results have a basic value describing their succession and a reason for their failure. Well, if they had any.
  • Method Details

    • isPassed

      public boolean isPassed()
      Returns true if the command executor passes (gave a correct argument for) whatever you get this result from.
      Returns:
      true if this result is passed. false otherwise
    • getReason

      @Nullable public @Nullable String getReason()
      Returns the reason of why this result does not pass, if it doesn't.
      Returns:
      A reason if this result didn't passed.
    • hasReason

      public boolean hasReason()
      Returns true if this result has a reason. false otherwise.
      Returns:
      Whether this handle result has a reason (probably for failing)
    • success

      public static ArgumentHandleResult success()
      Constructs a new ArgumentHandleResult, leading to success.
      Returns:
      An instance of a ArgumentHandleResult with isPassed() being true.
    • fail

      public static ArgumentHandleResult fail(String reason)
      Constructs a new ArgumentHandleResult, leading to failure with the reason given.
      Parameters:
      reason - A reason on the failure that this result will cause.
      Returns:
      An instance of a ArgumentHandleResult with a reason and isPassed() being false