Fixed values being able to go over number limit

This commit is contained in:
coolGi
2023-07-17 00:27:32 +09:30
parent ce3a06e410
commit 66f4595b7b
2 changed files with 7 additions and 2 deletions
@@ -52,7 +52,12 @@ public class ConfigBase
*/
public static final List<Class<?>> acceptableInputs = new ArrayList<Class<?>>() {{
add(Boolean.class);
add(Number.class); // Contains: Byte, Short, Int, Long, Double, Float0
add(Byte.class);
add(Integer.class);
add(Double.class);
add(Short.class);
add(Long.class);
add(Float.class);
add(String.class);
// TODO[CONFIG]: Check the type of these is valid
@@ -207,7 +207,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
if (this.configBase.disableMinMax)
return 0;
if (value.getClass() != this.value.getClass()) // If the 2 variables aren't the same type then it will be invalid
if (value == null || this.value == null || value.getClass() != this.value.getClass()) // If the 2 variables aren't the same type then it will be invalid
return 2;
if (Number.class.isAssignableFrom(value.getClass())) { // Only check min max if it is a number
if (max != null && NumberUtil.greaterThan((Number) value, (Number) max))