File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
commands/src/main/java/com/wizardlybump17/wlib/command/result Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ public interface CommandResult<T> {
7878 return new NoContentResult <>(lastInputIndex , lastNode );
7979 }
8080
81+ static <T > @ NotNull NotFoundResult <T > notFound (int lastInputIndex , @ NotNull CommandNode <?> lastNode ) {
82+ return new NotFoundResult <>(lastInputIndex , lastNode );
83+ }
84+
8185 //with context
8286
8387 static <T > @ NotNull SuccessResult <T > successful (@ NotNull CommandContext context , @ Nullable T data ) {
@@ -107,4 +111,8 @@ public interface CommandResult<T> {
107111 static <T > @ NotNull NoContentResult <T > noContent (@ NotNull CommandContext context ) {
108112 return noContent (context .lastInputIndex (), context .lastNode ());
109113 }
114+
115+ static <T > @ NotNull NotFoundResult <T > notFound (@ NotNull CommandContext context ) {
116+ return notFound (context .lastInputIndex (), context .lastNode ());
117+ }
110118}
Original file line number Diff line number Diff line change 1+ package com .wizardlybump17 .wlib .command .result .error ;
2+
3+ import com .wizardlybump17 .wlib .command .node .CommandNode ;
4+ import org .jetbrains .annotations .NotNull ;
5+
6+ public record NotFoundResult <T >(int lastInputIndex , @ NotNull CommandNode <?> lastNode ) implements UnsuccessResult <T > {
7+
8+ public static final @ NotNull String ID = "WLib:Error/NotFound" ;
9+
10+ @ Override
11+ public @ NotNull String id () {
12+ return ID ;
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments