Start refactoring of command handling (work in progress)
Preparation: - Remove unused API - Move some logic from "data classes" elsewhere
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user