Class ArgumentHandleResult
java.lang.Object
me.efekos.simpler.commands.syntax.ArgumentHandleResult
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 Summary
Modifier and TypeMethodDescriptionstatic ArgumentHandleResultConstructs a newArgumentHandleResult, leading to failure with the reason given.@Nullable StringReturns the reason of why this result does not pass, if it doesn't.booleanReturnstrueif this result has a reason.booleanisPassed()Returnstrueif the command executor passes (gave a correct argument for) whatever you get this result from.static ArgumentHandleResultsuccess()Constructs a newArgumentHandleResult, leading to success.
-
Method Details
-
isPassed
public boolean isPassed()Returnstrueif the command executor passes (gave a correct argument for) whatever you get this result from.- Returns:
trueif this result is passed.falseotherwise
-
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()Returnstrueif this result has a reason.falseotherwise.- Returns:
- Whether this handle result has a reason (probably for failing)
-
success
Constructs a newArgumentHandleResult, leading to success.- Returns:
- An instance of a
ArgumentHandleResultwithisPassed()beingtrue.
-
fail
Constructs a newArgumentHandleResult, leading to failure with the reason given.- Parameters:
reason- A reason on the failure that this result will cause.- Returns:
- An instance of a
ArgumentHandleResultwith a reason andisPassed()beingfalse
-