9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Fix long config (#617)

This commit is contained in:
Lumine1909
2025-07-26 04:59:10 -07:00
committed by GitHub
parent eb3d87b8aa
commit 6a2b9ee6b3
2 changed files with 9 additions and 1 deletions

View File

@@ -932,7 +932,7 @@ public final class LeavesConfig {
@Override
public void verify(Long old, Long value) throws IllegalArgumentException {
if (value <= 0) {
throw new IllegalArgumentException("Max nbt size can not be <= 0!");
throw new IllegalArgumentException("Max nbt size can not be <= 0");
}
}
}

View File

@@ -36,6 +36,14 @@ public abstract class ConfigValidatorImpl<E> implements ConfigValidator<E> {
public Long stringConvert(String value) throws IllegalArgumentException {
return Long.parseLong(value);
}
@Override
public Long loadConvert(Object value) throws IllegalArgumentException {
if (value instanceof Integer) {
return Long.valueOf((Integer) value);
}
return (Long) value;
}
}
public static class StringConfigValidator extends ConfigValidatorImpl<String> {