Annotation Interface ConfigSection


@Retention(RUNTIME) @Target(FIELD) public @interface ConfigSection
Annotation that defines a collapsible section in the configuration panel.

Sections are used to group related configuration items together in the UI. Each section can be expanded or collapsed by the user, and can optionally start in a collapsed state.

To define a section, annotate a String field in your Config interface:


 @ConfigGroup("myplugin")
 public interface MyConfig extends Config {
     @ConfigSection(
         name = "Advanced Settings",
         description = "Settings for advanced users",
         position = 1,
         closedByDefault = true
     )
     String advancedSection = "Advanced";

     @ConfigItem(
         keyName = "debugMode",
         name = "Debug Mode",
         description = "Enable debug logging",
         section = "Advanced"  // References the section
     )
     default boolean debugMode() {
         return false;
     }
 }
 

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    A description of what this section contains.
    The display name of the section.
    int
    The display position of this section.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the section should be collapsed by default.
    boolean
    Whether this section should be hidden from the UI.
    The key name for storing the section's collapsed state.
    The parent section this section belongs to.
    The key name of a config item that controls this section's visibility.
  • Element Details

    • name

      String name
      The display name of the section.
      Returns:
      the section title shown in the UI
    • description

      String description
      A description of what this section contains.

      Displayed as a tooltip when hovering over the section header.

      Returns:
      the section description
    • position

      int position
      The display position of this section.

      Sections are sorted by position in ascending order.

      Returns:
      the position value
    • closedByDefault

      boolean closedByDefault
      Whether the section should be collapsed by default.

      When true, users must click to expand the section. When false, the section is expanded initially.

      Returns:
      true if collapsed by default, false otherwise (default)
      Default:
      false
    • keyName

      String keyName
      The key name for storing the section's collapsed state.

      If not specified, uses the field name as the key.

      Returns:
      the key name, or empty string to use field name
      Default:
      ""
    • section

      String section
      The parent section this section belongs to.

      Allows creating nested sections.

      Returns:
      the parent section field name, or empty string for top-level
      Default:
      ""
    • hidden

      boolean hidden
      Whether this section should be hidden from the UI.
      Returns:
      true if hidden, false otherwise (default)
      Default:
      false
    • unhide

      String unhide
      The key name of a config item that controls this section's visibility.

      When the specified item's value is truthy, this section becomes visible.

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