Annotation Interface ConfigItem
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 -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?> The class containing the parse method.booleanWhether this item's content is collapsible in the UI.The key name of another config item that controls disabling.The value that triggers disabling.booleanWhether this item can be edited by users.The key name of another config item that controls enabling.The value that triggers enabling.The enum class used for multiple selection config items.booleanWhether 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.booleanWhether to parse the value using a custom parser.intThe position of this item in the configuration panel.booleanWhether 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.booleanWhether this item should use a wide layout in the UI.
-
Element Details
-
position
int positionThe 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 keyNameThe storage key for this configuration item.This key is combined with the
ConfigGroupvalue to form the complete storage key. Should be stable across versions.- Returns:
- the configuration key name
-
name
String nameThe display name shown in the configuration panel.- Returns:
- the human-readable name
-
description
String descriptionA description explaining what this configuration item does.Displayed as a tooltip or help text in the configuration panel.
- Returns:
- the description text
-
warning
String warningA 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 secretWhether 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 sectionThe 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 titleThe 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 parseWhether to parse the value using a custom parser.- Returns:
- true to use custom parsing, false otherwise (default)
- Default:
false
-
clazz
Class<?> clazzThe class containing the parse method.- Returns:
- the class with the parse method, or void.class for none
- Default:
void.class
-
method
String methodThe name of the parse method to use.- Returns:
- the method name, or empty string for none
- Default:
""
-
unhide
String unhideThe key name of another config item that controls visibility.When the specified item's value matches
unhideValue(), this item becomes visible. Used withhidden()set to true.- Returns:
- the controlling item's key name, or empty string
- Default:
""
-
unhideValue
String unhideValueThe 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 hideThe 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 hideValueThe value that triggers hiding.- Returns:
- the hide trigger value, or empty string
- Default:
""
-
enabledBy
String enabledByThe 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 enabledByValueThe value that triggers enabling.- Returns:
- the enable trigger value, or empty string
- Default:
""
-
disabledBy
String disabledByThe 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 disabledByValueThe value that triggers disabling.- Returns:
- the disable trigger value, or empty string
- Default:
""
-
collapsible
boolean collapsibleWhether this item's content is collapsible in the UI.- Returns:
- true if collapsible, false otherwise (default)
- Default:
false
-
wide
boolean wideWhether this item should use a wide layout in the UI.- Returns:
- true for wide layout, false otherwise (default)
- Default:
false
-
editable
boolean editableWhether this item can be edited by users.- Returns:
- true if editable (default), false for read-only
- Default:
true
-
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
-