From 5e288e914f015adda495b3cd8570943b399172ff Mon Sep 17 00:00:00 2001 From: xander Date: Fri, 23 Sep 2022 14:12:38 +0100 Subject: 1.4.4 Fix search not behaving properly with default collapsed option groups Minor refactors --- src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/dev/isxander/yacl/api') 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 categories) { - Validate.notEmpty(categories, "`categories` cannot be empty"); + public Builder categories(@NotNull Collection 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); } -- cgit