Annotation Interface ConfigItem


@Retention(RUNTIME) @Target(METHOD) public @interface ConfigItem
Annotation that defines a configuration item within a Config interface.

Each method in a configuration interface that should be a configurable setting must be annotated with @ConfigItem. The annotation specifies how the configuration item is stored, displayed, and behaves in the UI.

Example usage:


 @ConfigGroup("myplugin")
 public interface MyConfig extends Config {
     @ConfigItem(
         keyName = "enableNotifications",
         name = "Enable Notifications",
         description = "Show notification messages",
         position = 1
     )
     default boolean enableNotifications() {
         return true;
     }

     @ConfigItem(
         keyName = "notificationSound",
         name = "Sound",
         description = "Sound to play",
         position = 2,
         hidden = true,
         unhide = "enableNotifications"
     )
     default NotificationSound sound() {
         return NotificationSound.BEEP;
     }
 }
 

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    A description explaining what this configuration item does.
    The storage key for this configuration item.
    The display name shown in the configuration panel.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The class containing the parse method.
    boolean
    Whether this item's content is collapsible in the UI.
    The key name of another config item that controls disabling.
    The value that triggers disabling.
    boolean
    Whether this item can be edited by users.
    The key name of another config item that controls enabling.
    The value that triggers enabling.
    Class<? extends Enum>
    The enum class used for multiple selection config items.
    boolean
    Whether this item should be hidden from the configuration panel.
    The key name of another config item that controls hiding.
    The value that triggers hiding.
    The name of the parse method to use.
    boolean
    Whether to parse the value using a custom parser.
    int
    The position of this item in the configuration panel.
    boolean
    Whether this configuration value should be treated as secret.
    The section this item belongs to.
    The title group this item belongs to.
    The key name of another config item that controls visibility.
    The value that triggers unhiding.
    A warning message to display when changing this configuration.
    boolean
    Whether this item should use a wide layout in the UI.
  • Element Details

    • position

      int position
      The position of this item in the configuration panel.

      Items are sorted by position in ascending order. Items with the same position are displayed in declaration order.

      Returns:
      the display position, or -1 for default ordering
      Default:
      -1
    • keyName

      String keyName
      The storage key for this configuration item.

      This key is combined with the ConfigGroup value to form the complete storage key. Should be stable across versions.

      Returns:
      the configuration key name
    • name

      String name
      The display name shown in the configuration panel.
      Returns:
      the human-readable name
    • description

      String description
      A description explaining what this configuration item does.

      Displayed as a tooltip or help text in the configuration panel.

      Returns:
      the description text
    • hidden

      boolean hidden
      Whether this item should be hidden from the configuration panel.

      Hidden items can still be read and written programmatically, but won't be displayed to users.

      Returns:
      true if hidden, false otherwise (default)
      Default:
      false
    • warning

      String warning
      A warning message to display when changing this configuration.

      If set, users will be prompted with this warning before the configuration change is applied.

      Returns:
      the warning message, or empty string for no warning
      Default:
      ""
    • secret

      boolean secret
      Whether this configuration value should be treated as secret.

      Secret values are hidden in the UI (e.g., shown as asterisks) and may have additional protection.

      Returns:
      true if secret, false otherwise (default)
      Default:
      false
    • section

      String section
      The section this item belongs to.

      Sections group related configuration items together in the UI. Specify the section field name defined with ConfigSection.

      Returns:
      the section field name, or empty string for no section
      Default:
      ""
    • title

      String title
      The title group this item belongs to.

      Titles provide headings within sections. Specify the title field name defined with ConfigTitle.

      Returns:
      the title field name, or empty string for no title
      Default:
      ""
    • parse

      boolean parse
      Whether to parse the value using a custom parser.
      Returns:
      true to use custom parsing, false otherwise (default)
      Default:
      false
    • clazz

      Class<?> clazz
      The class containing the parse method.
      Returns:
      the class with the parse method, or void.class for none
      Default:
      void.class
    • method

      String method
      The name of the parse method to use.
      Returns:
      the method name, or empty string for none
      Default:
      ""
    • unhide

      String unhide
      The key name of another config item that controls visibility.

      When the specified item's value matches unhideValue(), this item becomes visible. Used with hidden() set to true.

      Returns:
      the controlling item's key name, or empty string
      Default:
      ""
    • unhideValue

      String unhideValue
      The value that triggers unhiding.

      When the item specified by unhide() equals this value, this item becomes visible.

      Returns:
      the unhide trigger value, or empty string for any truthy value
      Default:
      ""
    • hide

      String hide
      The key name of another config item that controls hiding.

      When the specified item's value matches hideValue(), this item becomes hidden.

      Returns:
      the controlling item's key name, or empty string
      Default:
      ""
    • hideValue

      String hideValue
      The value that triggers hiding.
      Returns:
      the hide trigger value, or empty string
      Default:
      ""
    • enabledBy

      String enabledBy
      The key name of another config item that controls enabling.

      When the specified item's value matches enabledByValue(), this item becomes enabled (editable).

      Returns:
      the controlling item's key name, or empty string
      Default:
      ""
    • enabledByValue

      String enabledByValue
      The value that triggers enabling.
      Returns:
      the enable trigger value, or empty string
      Default:
      ""
    • disabledBy

      String disabledBy
      The key name of another config item that controls disabling.

      When the specified item's value matches disabledByValue(), this item becomes disabled (not editable).

      Returns:
      the controlling item's key name, or empty string
      Default:
      ""
    • disabledByValue

      String disabledByValue
      The value that triggers disabling.
      Returns:
      the disable trigger value, or empty string
      Default:
      ""
    • collapsible

      boolean collapsible
      Whether this item's content is collapsible in the UI.
      Returns:
      true if collapsible, false otherwise (default)
      Default:
      false
    • wide

      boolean wide
      Whether this item should use a wide layout in the UI.
      Returns:
      true for wide layout, false otherwise (default)
      Default:
      false
    • editable

      boolean editable
      Whether this item can be edited by users.
      Returns:
      true if editable (default), false for read-only
      Default:
      true
    • enumClass

      Class<? extends Enum> enumClass
      The enum class used for multiple selection config items.

      When a config item returns a Set of enum values, specify the enum class here to enable proper UI rendering and debugging.

      Returns:
      the enum class for multiple selection, or Enum.class for none
      Default:
      java.lang.Enum.class