Skip to content

Commit 6a73cca

Browse files
committed
some fixes
1 parent 8918fc7 commit 6a73cca

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

common/src/main/java/revxrsal/commands/annotation/Values.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import org.jetbrains.annotations.NotNull;
44

5+
import java.lang.annotation.ElementType;
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
import java.lang.annotation.Target;
9+
510
/**
611
* A utility annotation that marks a field as <em>only</em> accepting certain
712
* values. This will take care of validation, tab-completion and errors.
@@ -13,6 +18,8 @@
1318
* <p>
1419
* Values can be of any type, including strings, integers, enums, etc.
1520
*/
21+
@Target(ElementType.PARAMETER)
22+
@Retention(RetentionPolicy.RUNTIME)
1623
public @interface Values {
1724

1825
/**

common/src/main/java/revxrsal/commands/parameter/builtins/ValuesParameterTypeFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public T parse(@NotNull MutableStringStream input, @NotNull ExecutionContext<@No
6464
@SuppressWarnings("unchecked")
6565
T value = (T) delegate.parse(input, context);
6666
int end = input.position();
67+
input.setPosition(start);
6768
String consumed = input.peek(end - start);
69+
input.setPosition(end);
6870

6971
if ((values.caseSensitive() && allowed.contains(consumed))
7072
|| (!values.caseSensitive() && allowed.contains(consumed.toUpperCase())))

0 commit comments

Comments
 (0)