Start refactoring of command handling (work in progress)

Preparation:
- Remove unused API
- Move some logic from "data classes" elsewhere
This commit is contained in:
ljacqu
2015-11-30 21:09:52 +01:00
parent da0c5d1ea2
commit a4c45e126e
7 changed files with 140 additions and 228 deletions
@@ -0,0 +1,21 @@
package fr.xephi.authme.command;
public final class CommandUtils {
public static int getMinNumberOfArguments(CommandDescription command) {
int mandatoryArguments = 0;
for (CommandArgumentDescription argument : command.getArguments()) {
if (!argument.isOptional()) {
++mandatoryArguments;
}
}
return mandatoryArguments;
}
public static int getMaxNumberOfArguments(CommandDescription command) {
return command.hasMaximumArguments()
? command.getArguments().size()
: -1;
}
}