aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-23 14:12:38 +0100
committerxander <xander@isxander.dev>2022-09-23 14:12:38 +0100
commit5e288e914f015adda495b3cd8570943b399172ff (patch)
treed91b309e0fbeb6c5b9d420ac818637ba3170ec73 /src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java
parentf77914f74903164c34bf44bfbe4c298da87e1e32 (diff)
downloadYetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.gz
YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.bz2
YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.zip
1.4.4
Fix search not behaving properly with default collapsed option groups Minor refactors
Diffstat (limited to 'src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java')
-rw-r--r--src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java b/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java
index 34ccc6a..a69ae4e 100644
--- a/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java
+++ b/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java
@@ -94,8 +94,8 @@ public interface YetAnotherConfigLib {
*
* @see YetAnotherConfigLib#categories()
*/
- public Builder categories(@NotNull Collection<ConfigCategory> categories) {
- Validate.notEmpty(categories, "`categories` cannot be empty");
+ public Builder categories(@NotNull Collection<? extends ConfigCategory> categories) {
+ Validate.notNull(categories, "`categories` cannot be null");
this.categories.addAll(categories);
return this;
@@ -128,6 +128,7 @@ public interface YetAnotherConfigLib {
public YetAnotherConfigLib build() {
Validate.notNull(title, "`title must not be null to build `YetAnotherConfigLib`");
Validate.notEmpty(categories, "`categories` must not be empty to build `YetAnotherConfigLib`");
+ Validate.isTrue(!categories.stream().allMatch(category -> category instanceof PlaceholderCategory), "At least one regular category is required to build `YetAnotherConfigLib`");
return new YetAnotherConfigLibImpl(title, ImmutableList.copyOf(categories), saveFunction, initConsumer);
}