File tree Expand file tree Collapse file tree
commands/src/main/java/com/wizardlybump17/wlib/command/result Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ public interface CommandResult<T> {
8686 return new ConflictResult <>(lastInputIndex , lastNode );
8787 }
8888
89+ static <T > @ NotNull BadRequestResult <T > badRequest (int lastInputIndex , @ NotNull CommandNode <?> lastNode ) {
90+ return new BadRequestResult <>(lastInputIndex , lastNode );
91+ }
92+
8993 //with context
9094
9195 static <T > @ NotNull SuccessResult <T > successful (@ NotNull CommandContext context , @ Nullable T data ) {
@@ -123,4 +127,8 @@ public interface CommandResult<T> {
123127 static <T > @ NotNull ConflictResult <T > conflict (@ NotNull CommandContext context ) {
124128 return conflict (context .lastInputIndex (), context .lastNode ());
125129 }
130+
131+ static <T > @ NotNull BadRequestResult <T > badRequest (@ NotNull CommandContext context ) {
132+ return badRequest (context .lastInputIndex (), context .lastNode ());
133+ }
126134}
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 BadRequestResult <T >(int lastInputIndex , @ NotNull CommandNode <?> lastNode ) implements UnsuccessResult <T > {
7+
8+ public static final @ NotNull String ID = "WLib:Error/BadRequest" ;
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