Constraints
Some annotations apply constraints on options, limiting what values are valid. If during loading an option is outside of its constraint, it will either be clamped or reset to its default value.
This constraint applies to numeric options and puts a lower bound on the value.
If you’re using BigInteger or BigDecimal, use @BigMin instead.
Example:
@Min(1)public int atLeastOne = 1;@BigMin("1000000")public BigInteger atLeastOneMillion = new BigInteger("1000000");This constraints applies to numeric options and puts an upper bound on the value.
If you’re using BigInteger or BigDecimal, use @BigMax instead.
Example:
@Max(10)public int atMostTen = 10;@Max("0")public BigInteger lessThanZero = new BigInteger("-1000000");@Range
Section titled “@Range”This constraint applies to numeric options and clamps the value between min and max, displaying it as a slider in the config screen.
If you’re using BigInteger or BigDecimal, use @BigRange instead.
Example:
@Range(min = 0.1, max = 10)public float spawnMultiplier = 1f;@BigRange(min = "0", max = "3.141592654")public BigDecimal betweenZeroAndPi = new BigDecimal("3.141592654");@Percentage
Section titled “@Percentage”This constraints applies to decimal options and clamps the value between 0.0 and 1.0, displaying it as a percentage slider in the config screen.
Example:
@Percentagepublic float aFloatOption = 0.5f;@Percentagepublic BigDecimal aBigDecimalOption = new BigDecimal("0.0000005");@Regex
Section titled “@Regex”This constraint applies to strings and characters, requiring the value to match the given regular expression.
Example:
@Regex("[a-z_]{1,15}")public String aStringOption = "hello_world";@Regex("[a-fA-F]")public char aCharOption = 'A';