Don't hardcode number count

This commit is contained in:
Németh Noel 2021-07-09 01:54:04 +02:00
parent 0f569d85f0
commit 7f215ac899
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ public class ArgumentRelativeVec2 extends ArgumentRelative<RelativeVec> {
@Override @Override
public RelativeVec parse(@NotNull String input) throws ArgumentSyntaxException { public RelativeVec parse(@NotNull String input) throws ArgumentSyntaxException {
final String[] split = input.split(StringUtils.SPACE); final String[] split = input.split(StringUtils.SPACE);
if (split.length != 2) { if (split.length != getNumberCount()) {
throw new ArgumentSyntaxException("Invalid number of values", input, INVALID_NUMBER_COUNT_ERROR); throw new ArgumentSyntaxException("Invalid number of values", input, INVALID_NUMBER_COUNT_ERROR);
} }
return RelativeVec.parse(split); return RelativeVec.parse(split);

View File

@ -23,7 +23,7 @@ public class ArgumentRelativeVec3 extends ArgumentRelative<RelativeVec> {
@Override @Override
public RelativeVec parse(@NotNull String input) throws ArgumentSyntaxException { public RelativeVec parse(@NotNull String input) throws ArgumentSyntaxException {
final String[] split = input.split(StringUtils.SPACE); final String[] split = input.split(StringUtils.SPACE);
if (split.length != 3) { if (split.length != getNumberCount()) {
throw new ArgumentSyntaxException("Invalid number of values", input, INVALID_NUMBER_COUNT_ERROR); throw new ArgumentSyntaxException("Invalid number of values", input, INVALID_NUMBER_COUNT_ERROR);
} }
return RelativeVec.parse(split); return RelativeVec.parse(split);