Skip to content

Commit 6520012

Browse files
committed
Fixed Command#max not working properly
1 parent 16aea63 commit 6520012

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/me/despical/commandframework/CommandFramework.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private Map.Entry<Command, Map.Entry<Method, Object>> getAssociatedCommand(@NotN
297297
final long argCount = command.name().chars().mapToObj(c -> (char) c).filter(c -> c == '.').count();
298298

299299
// Extra check for possible arguments.
300-
if (command.min() >= possibleArgs.length - argCount || command.allowInfiniteArgs()) {
300+
if (command.min() >= possibleArgs.length - argCount || possibleArgs.length - argCount <= command.max() || command.allowInfiniteArgs()) {
301301
return Utils.mapEntry(command, subCommands.get(command));
302302
}
303303
}
@@ -315,7 +315,7 @@ private Map.Entry<Command, Map.Entry<Method, Object>> getAssociatedCommand(@NotN
315315
// If we found the command return it, otherwise return null
316316
if (command != null) {
317317
// Quick fix to accept any match consumer if defined
318-
if (command.min() >= possibleArgs.length || command.allowInfiniteArgs()) {
318+
if (command.min() >= possibleArgs.length || possibleArgs.length <= command.max() || command.allowInfiniteArgs()) {
319319
return Utils.mapEntry(command, commands.get(command));
320320
}
321321
}

0 commit comments

Comments
 (0)