diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index e2240a133..e11ebd437 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -168,20 +168,24 @@ public class ConfigEntry extends AbstractConfigType> implem * Checks if the option is valid * * @return 0 == valid - *

1 == number too high + *

2 == invalid + *

1 == number too high *

-1 == number too low */ @Override public byte isValid() { - return isValid(value); + return isValid(this.value); } /** Checks if a value is valid */ @Override public byte isValid(T value) { 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 + return 2; if (Number.class.isAssignableFrom(value.getClass())) { // Only check min max if it is a number - if (this.max != null && Double.parseDouble(value.toString()) > Double.parseDouble(max.toString())) + if (this.max != null && Double.parseDouble(value.toString()) > Double.parseDouble(max.toString())) // TODO: Use something larger and more precise like float return 1; if (this.min != null && Double.parseDouble(value.toString()) < Double.parseDouble(min.toString())) return -1;