Skip to content

Commit

Permalink
Small cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollczi committed Nov 14, 2021
1 parent e2ec47e commit b2e3f2b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Option<ScopeMetaData> parse(AnnotatedElement annotatedElement) {
}

if (annotation instanceof UsageMessage usageMessage) {
builder.message(ValidationInfo.INCORRECT_USE, usageMessage.value());
builder.message(ValidationInfo.INVALID_USE, usageMessage.value());
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void resolve(Data data) {
Valid.whenWithContext(!sender.hasPermission(permission), ValidationInfo.NO_PERMISSION, data, this);
}

Valid.whenWithContext(!scope.getArgsValidator().valid(data.getCurrentArgsCount(this)), ValidationInfo.INCORRECT_USE, data, this);
Valid.whenWithContext(!scope.getArgsValidator().valid(data.getCurrentArgsCount(this)), ValidationInfo.INVALID_USE, data, this);

executor.execute(new InjectContext(data, this)).onError(error -> {
if (error.getSecond() instanceof ValidationCommandException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class ReflectUtils {
public final class ReflectUtils {

private ReflectUtils() {}

public static String formatMethod(Method method) {
return method.getDeclaringClass().getSimpleName() + "#" + method.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
public enum ValidationInfo {

COMMAND_NO_FOUND("&cCommand or subcommand not found"),
NO_PERMISSION("&cNie posiadasz permisji do tej komendy!"),
INCORRECT_USE("&cNie poprawne uzycie komendy!"),
NO_PERMISSION("&cYou don't have permission to this command"),
INVALID_USE("&cInvalid use of the command"),
CUSTOM(StringUtils.EMPTY);

private final String defaultMessage;
Expand Down

0 comments on commit b2e3f2b

Please sign in to comment.