diff options
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java index 2db8acd..37eddfd 100644 --- a/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java @@ -64,8 +64,7 @@ public final class OptionGroupImpl implements OptionGroup { @ApiStatus.Internal public static final class BuilderImpl implements Builder { private Component name = Component.empty(); - private OptionDescription description = null; - private OptionDescription.Builder legacyBuilder = null; + private OptionDescription description = OptionDescription.EMPTY; private final List<Option<?>> options = new ArrayList<>(); private boolean collapsed = false; @@ -79,7 +78,6 @@ public final class OptionGroupImpl implements OptionGroup { @Override public Builder description(@NotNull OptionDescription description) { - Validate.isTrue(legacyBuilder == null, "Cannot set description when deprecated `tooltip` method is used"); Validate.notNull(description, "`description` must not be null"); this.description = description; @@ -87,17 +85,6 @@ public final class OptionGroupImpl implements OptionGroup { } @Override - public Builder tooltip(@NotNull Component... tooltips) { - Validate.isTrue(description == null, "Cannot use deprecated `tooltip` method when `description` in use."); - Validate.notEmpty(tooltips, "`tooltips` cannot be empty"); - - ensureLegacyDescriptionBuilder(); - - legacyBuilder.description(tooltips); - return this; - } - - @Override public Builder option(@NotNull Option<?> option) { Validate.notNull(option, "`option` must not be null"); @@ -129,23 +116,7 @@ public final class OptionGroupImpl implements OptionGroup { public OptionGroup build() { Validate.notEmpty(options, "`options` must not be empty to build `OptionGroup`"); - if (description == null) { - if (ensureLegacyDescriptionBuilder()) - YACLConstants.LOGGER.warn("Using deprecated `tooltip` method in option group '{}'. Use `description` instead.", name != null ? name.getString() : "unnamed group"); - - description = legacyBuilder.build(); - } - return new OptionGroupImpl(name, description, ImmutableList.copyOf(options), collapsed, false); } - - private boolean ensureLegacyDescriptionBuilder() { - if (legacyBuilder == null) { - legacyBuilder = OptionDescription.createBuilder(); - return false; - } else { - return true; - } - } } } |