use of org.spongepowered.common.accessor.network.chat.StyleAccessor in project SpongeCommon by SpongePowered.
the class StyleMixin method bridge$asAdventure.
@Override
@SuppressWarnings("ConstantConditions")
public net.kyori.adventure.text.format.Style bridge$asAdventure() {
if (this.bridge$adventure == null) {
final net.kyori.adventure.text.format.Style.Builder builder = net.kyori.adventure.text.format.Style.style();
final Style $this = (Style) (Object) this;
final StyleAccessor $access = (StyleAccessor) this;
// font
builder.font(SpongeAdventure.asAdventure($access.accessor$font()));
// color
builder.color(SpongeAdventure.asAdventure($this.getColor()));
// decorations
builder.decoration(TextDecoration.OBFUSCATED, TextDecoration.State.byBoolean($access.accessor$obfuscated()));
builder.decoration(TextDecoration.BOLD, TextDecoration.State.byBoolean($access.accessor$bold()));
builder.decoration(TextDecoration.STRIKETHROUGH, TextDecoration.State.byBoolean($access.accessor$strikethrough()));
builder.decoration(TextDecoration.UNDERLINED, TextDecoration.State.byBoolean($access.accessor$underlined()));
builder.decoration(TextDecoration.ITALIC, TextDecoration.State.byBoolean($access.accessor$italic()));
// events
final HoverEvent hoverEvent = $this.getHoverEvent();
if (hoverEvent != null) {
builder.hoverEvent(SpongeAdventure.asAdventure(hoverEvent));
}
final ClickEvent clickEvent = $this.getClickEvent();
if (clickEvent != null) {
builder.clickEvent(net.kyori.adventure.text.event.ClickEvent.clickEvent(SpongeAdventure.asAdventure(clickEvent.getAction()), clickEvent.getValue()));
}
// insertion
builder.insertion($this.getInsertion());
this.bridge$adventure = builder.build();
}
return this.bridge$adventure;
}
Aggregations