Annotation Interface MaxValue


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface MaxValue
Specifies the maximum value for numeric configuration fields. When a config value is loaded that is greater than the maximum, it will be automatically clamped to the maximum value.

Supports: byte, short, int, long, float, double and their wrapper types.

Example:

@ConfigValue("max_players")
@MaxValue(100)
@Comment("Maximum players (maximum: 100)")
private int maxPlayers = 20;
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    double
    The maximum allowed value for this field.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether to log a warning when a value is clamped.
  • Element Details

    • value

      double value
      The maximum allowed value for this field.
      Returns:
      the maximum value
    • warn

      boolean warn
      Whether to log a warning when a value is clamped.
      Returns:
      true to log warnings, false otherwise
      Default:
      true