mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-20 07:02:32 +01:00
Don't hardcode number count
This commit is contained in:
parent
0f569d85f0
commit
7f215ac899
@ -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);
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user