Skip to content

Commit

Permalink
@arg should default to null not empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 28, 2022
1 parent 9f21659 commit 97d167b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/citizensnpcs/api/command/Arg.java
Expand Up @@ -19,6 +19,8 @@

Class<? extends CompletionsProvider> completionsProvider() default CompletionsProvider.Identity.class;

String defValue() default "";

Class<? extends FlagValidator<?>> validator() default FlagValidator.Identity.class;

int value();
Expand Down
Expand Up @@ -688,11 +688,11 @@ private static class InjectedCommandArgument {
private FlagValidator<?> validator;

public InjectedCommandArgument(Class<?> paramType, Arg arg) {
this.defaultValue = "";
this.names = new String[] {};
this.paramType = paramType;
this.names = new String[] {};
this.index = arg.value();
this.completions = arg.completions();
this.defaultValue = arg.defValue().isEmpty() ? null : arg.defValue();
if (arg.validator() != FlagValidator.Identity.class) {
try {
this.validator = arg.validator().getConstructor().newInstance();
Expand Down

0 comments on commit 97d167b

Please sign in to comment.