diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/result/Result.java b/src/main/java/com/onarandombox/MultiverseCore/utils/result/Result.java index 386e7a95..57fcd9d9 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/result/Result.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/result/Result.java @@ -16,39 +16,39 @@ public sealed interface Result boolean isFailure(); - S successReason(); + S getSuccessReason(); - F failureReason(); + F getFailureReason(); default Result onSuccess(Consumer consumer) { if (this.isSuccess()) { - consumer.accept(this.successReason()); + consumer.accept(this.getSuccessReason()); } return this; } default Result onFailure(Consumer consumer) { if (this.isFailure()) { - consumer.accept(this.failureReason()); + consumer.accept(this.getFailureReason()); } return this; } default Result onSuccessReason(S successReason, Consumer consumer) { - if (this.isSuccess() && this.successReason() == successReason) { - consumer.accept(this.successReason()); + if (this.isSuccess() && this.getSuccessReason() == successReason) { + consumer.accept(this.getSuccessReason()); } return this; } default Result onFailureReason(F failureReason, Consumer consumer) { - if (this.isFailure() && this.failureReason() == failureReason) { - consumer.accept(this.failureReason()); + if (this.isFailure() && this.getFailureReason() == failureReason) { + consumer.accept(this.getFailureReason()); } return this; } - record Success(S successReason) implements Result { + record Success(S getSuccessReason) implements Result { @Override public boolean isSuccess() { return true; @@ -60,12 +60,12 @@ public sealed interface Result } @Override - public F failureReason() { + public F getFailureReason() { throw new NoSuchElementException("No failure reason for success"); } } - record Failure(F failureReason) implements Result { + record Failure(F getFailureReason) implements Result { @Override public boolean isSuccess() { return false; @@ -77,7 +77,7 @@ public sealed interface Result } @Override - public S successReason() { + public S getSuccessReason() { throw new NoSuchElementException("No success reason for failure"); } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/result/ResultGroup.java b/src/main/java/com/onarandombox/MultiverseCore/utils/result/ResultGroup.java index 120f9d8c..ccd7976b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/result/ResultGroup.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/result/ResultGroup.java @@ -69,7 +69,7 @@ public class ResultGroup { return Option.none(); } return Option.ofOptional(results.stream() - .map(Result::successReason) + .map(Result::getSuccessReason) .filter(successReasonClass::isInstance) .map(successReasonClass::cast) .findFirst()); @@ -80,7 +80,7 @@ public class ResultGroup { return Option.none(); } return Option.ofOptional(results.stream() - .map(Result::failureReason) + .map(Result::getFailureReason) .filter(failureReasonClass::isInstance) .map(failureReasonClass::cast) .findFirst());