Annotation Interface Units


@Retention(RUNTIME) @Target(METHOD) @Documented public @interface Units
Annotation that specifies the units to display alongside a numeric configuration value.

When applied to a ConfigItem method that returns a numeric type, the specified units will be displayed next to the input field in the configuration panel. This helps users understand what the value represents.

Common unit constants are provided for convenience:

Example usage:


 @ConfigItem(
     keyName = "refreshInterval",
     name = "Refresh Interval",
     description = "How often to refresh data"
 )
 @Units(Units.MILLISECONDS)
 @Range(min = 100, max = 5000)
 default int refreshInterval() {
     return 1000;
 }
 

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The units string to display.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Frames per second unit: " fps"
    static final String
    Gold pieces unit: " GP"
    static final String
    Levels unit: " lvls"
    static final String
    Milliseconds unit: "ms"
    static final String
    Minutes unit: " mins"
    static final String
    Percent unit: "%"
    static final String
    Pixels unit: "px"
    static final String
    Points unit: "pt"
    static final String
    Seconds unit: "s"
    static final String
    Game ticks unit: " ticks"