@@ -104,12 +104,29 @@ default Builder optionIf(boolean condition, @NotNull Supplier<@NotNull Option<?>
104104 * To add to another group, use {@link Builder#groups(Collection)}.
105105 * To construct an option, use {@link Option#createBuilder()}
106106 *
107+ * @param options the options to add
107108 * @see ConfigCategory#groups()
108109 * @see OptionGroup#isRoot()
109110 */
110111 @ Override
111112 Builder options (@ NotNull Collection <? extends Option <?>> options );
112113
114+ /**
115+ * Adds multiple options to the root group of the category if a condition is met.
116+ * To add to another group, use {@link Builder#groups(Collection)}.
117+ * To construct an option, use {@link Option#createBuilder()}
118+ *
119+ * @param condition whether to add the options
120+ * @param options the options to add
121+ * @see ConfigCategory#groups()
122+ * @see OptionGroup#isRoot()
123+ */
124+ @ Override
125+ default Builder optionsIf (boolean condition , @ NotNull Collection <? extends Option <?>> options ) {
126+ OptionAddable .super .optionsIf (condition , options );
127+ return this ;
128+ }
129+
113130 /**
114131 * Adds an option group.
115132 * To add an option to the root group, use {@link Builder#option(Option)}
@@ -155,9 +172,23 @@ default Builder groupIf(boolean condition, @NotNull Supplier<@NotNull OptionGrou
155172 * Adds multiple option groups.
156173 * To add multiple options to the root group, use {@link Builder#options(Collection)}
157174 * To construct a group, use {@link OptionGroup#createBuilder()}
175+ *
176+ * @param groups the groups to add
158177 */
159178 Builder groups (@ NotNull Collection <OptionGroup > groups );
160179
180+ /**
181+ * Adds multiple option groups if a condition is met.
182+ * To add multiple options to the root group, use {@link Builder#optionsIf(boolean, Collection)}
183+ * To construct a group, use {@link OptionGroup#createBuilder()}
184+ *
185+ * @param condition whether to add the groups
186+ * @param groups the groups to add
187+ */
188+ default Builder groupsIf (boolean condition , @ NotNull Collection <OptionGroup > groups ) {
189+ return condition ? groups (groups ) : this ;
190+ }
191+
161192 /**
162193 * Fetches the builder for the root group of the category.
163194 * This is the group that has no header and options are added through {@link Builder#option(Option)}.
0 commit comments