Skip to content

Commit da897a6

Browse files
added the ConflictResult
1 parent 2f1017c commit da897a6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

commands/src/main/java/com/wizardlybump17/wlib/command/result/CommandResult.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public interface CommandResult<T> {
8282
return new NotFoundResult<>(lastInputIndex, lastNode);
8383
}
8484

85+
static <T> @NotNull ConflictResult<T> conflict(int lastInputIndex, @NotNull CommandNode<?> lastNode) {
86+
return new ConflictResult<>(lastInputIndex, lastNode);
87+
}
88+
8589
//with context
8690

8791
static <T> @NotNull SuccessResult<T> successful(@NotNull CommandContext context, @Nullable T data) {
@@ -115,4 +119,8 @@ public interface CommandResult<T> {
115119
static <T> @NotNull NotFoundResult<T> notFound(@NotNull CommandContext context) {
116120
return notFound(context.lastInputIndex(), context.lastNode());
117121
}
122+
123+
static <T> @NotNull ConflictResult<T> conflict(@NotNull CommandContext context) {
124+
return conflict(context.lastInputIndex(), context.lastNode());
125+
}
118126
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 ConflictResult<T>(int lastInputIndex, @NotNull CommandNode<?> lastNode) implements UnsuccessResult<T> {
7+
8+
public static final @NotNull String ID = "WLib:Error/Conflict";
9+
10+
@Override
11+
public @NotNull String id() {
12+
return ID;
13+
}
14+
}

0 commit comments

Comments
 (0)