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 ArgumentHandleResult
Constructs a newArgumentHandleResult
, leading to failure with the reason given.@Nullable String
Returns the reason of why this result does not pass, if it doesn't.boolean
Returnstrue
if this result has a reason.boolean
isPassed()
Returnstrue
if the command executor passes (gave a correct argument for) whatever you get this result from.static ArgumentHandleResult
success()
Constructs a newArgumentHandleResult
, leading to success.
-
Method Details
-
isPassed
public boolean isPassed()Returnstrue
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
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()Returnstrue
if this result has a reason.false
otherwise.- Returns:
- Whether this handle result has a reason (probably for failing)
-
success
Constructs a newArgumentHandleResult
, leading to success.- Returns:
- An instance of a
ArgumentHandleResult
withisPassed()
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
ArgumentHandleResult
with a reason andisPassed()
beingfalse
-