aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-05-21 12:41:45 +0100
committerisXander <xandersmith2008@gmail.com>2023-05-21 12:41:45 +0100
commit21afea0da3956f2d8cca81a54fa9820152e0c077 (patch)
treee5944f94a5f85d3fcbe048da633e62f5357fe835 /common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
parente51af159ba3eba5ebda976bea1c1957cddeee7c6 (diff)
downloadYetAnotherConfigLib-21afea0da3956f2d8cca81a54fa9820152e0c077.tar.gz
YetAnotherConfigLib-21afea0da3956f2d8cca81a54fa9820152e0c077.tar.bz2
YetAnotherConfigLib-21afea0da3956f2d8cca81a54fa9820152e0c077.zip
Start overhauling UI
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java')
-rw-r--r--common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
index 11da99e..f0e0bdd 100644
--- a/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
@@ -19,7 +19,7 @@ import java.util.function.Function;
@ApiStatus.Internal
public final class ButtonOptionImpl implements ButtonOption {
private final Component name;
- private final Component tooltip;
+ private final OptionDescription description;
private final BiConsumer<YACLScreen, ButtonOption> action;
private boolean available;
private final Controller<BiConsumer<YACLScreen, ButtonOption>> controller;
@@ -27,13 +27,13 @@ public final class ButtonOptionImpl implements ButtonOption {
public ButtonOptionImpl(
@NotNull Component name,
- @Nullable Component tooltip,
+ @Nullable OptionDescription description,
@NotNull BiConsumer<YACLScreen, ButtonOption> action,
boolean available,
@NotNull Function<ButtonOption, Controller<BiConsumer<YACLScreen, ButtonOption>>> controlGetter
) {
this.name = name;
- this.tooltip = tooltip;
+ this.description = description;
this.action = action;
this.available = available;
this.controller = controlGetter.apply(this);
@@ -46,8 +46,13 @@ public final class ButtonOptionImpl implements ButtonOption {
}
@Override
+ public @NotNull OptionDescription description() {
+ return description;
+ }
+
+ @Override
public @NotNull Component tooltip() {
- return tooltip;
+ return description().description();
}
@Override
@@ -162,7 +167,7 @@ public final class ButtonOptionImpl implements ButtonOption {
public Builder tooltip(@NotNull Component... tooltips) {
Validate.notNull(tooltips, "`tooltips` cannot be empty");
- tooltipLines.addAll(List.of(tooltips));
+ //tooltipLines.addAll(List.of(tooltips));
return this;
}
@@ -212,7 +217,7 @@ public final class ButtonOptionImpl implements ButtonOption {
concatenatedTooltip.append(line);
}
- return new ButtonOptionImpl(name, concatenatedTooltip, action, available, controlGetter);
+ return new ButtonOptionImpl(name, OptionDescription.createBuilder().name(name).description(concatenatedTooltip).build(), action, available, controlGetter);
}
}
}