final /* @Nullable */ JsonElement rawValue = hoverEvent.get("value"); final /* @Nullable */ Component value = rawValue == null ? null : this.deserialize(rawValue, rawValue.getClass(), context); if(value != null) component.hoverEvent(new HoverEvent(action, value));
final /* @Nullable */ JsonElement rawValue = hoverEvent.get("value"); final /* @Nullable */ Component value = rawValue == null ? null : this.deserialize(rawValue, rawValue.getClass(), context); if(value != null) component.hoverEvent(new HoverEvent(action, value));
private <B extends BuildableComponent.Builder<?, ?>> void mergeStyle(final Component component, final B builder, final C context) { builder.mergeColor(component); builder.mergeDecorations(component); builder.clickEvent(component.clickEvent()); Optional.ofNullable(component.hoverEvent()).ifPresent(hoverEvent -> { builder.hoverEvent(new HoverEvent( hoverEvent.action(), this.render(hoverEvent.value(), context) )); }); }
/** * Resets all styling on this component. * * @return this builder */ @SuppressWarnings("unchecked") default @NonNull B resetStyle() { this.color(null); for(final TextDecoration decoration : TextDecoration.values()) this.decoration(decoration, TextDecoration.State.NOT_SET); this.clickEvent(null); this.hoverEvent(null); return (B) this; }
/** * Resets all styling on this component. * * @return this builder */ @SuppressWarnings("unchecked") default @NonNull B resetStyle() { this.color(null); for(final TextDecoration decoration : TextDecoration.values()) this.decoration(decoration, TextDecoration.State.NOT_SET); this.clickEvent(null); this.hoverEvent(null); return (B) this; }
/** * Merges the events from another component into this component. * * @param that the other component * @return this builder */ @SuppressWarnings("unchecked") default @NonNull B mergeEvents(final @NonNull Component that) { if(that.clickEvent() != null) this.clickEvent(that.clickEvent()); if(that.hoverEvent() != null) this.hoverEvent(that.hoverEvent().copy()); // hard copy, hover events have a component return (B) this; }
/** * Merges the events from another component into this component. * * @param that the other component * @return this builder */ @SuppressWarnings("unchecked") default @NonNull B mergeEvents(final @NonNull Component that) { if(that.clickEvent() != null) this.clickEvent(that.clickEvent()); if(that.hoverEvent() != null) this.hoverEvent(that.hoverEvent().copy()); // hard copy, hover events have a component return (B) this; }
/** * Resets all styling on this component. * * @return this builder */ default @NonNull B resetStyle() { this.color(null); for(final TextDecoration decoration : TextDecoration.values()) this.decoration(decoration, TextDecoration.State.NOT_SET); this.clickEvent(null); this.hoverEvent(null); return (B) this; }
private <B extends BuildableComponent.Builder<?, ?>> void mergeStyle(final Component component, final B builder, final C context) { builder.mergeColor(component); builder.mergeDecorations(component); builder.clickEvent(component.clickEvent()); Optional.ofNullable(component.hoverEvent()).ifPresent(hoverEvent -> { builder.hoverEvent(new HoverEvent( hoverEvent.action(), this.render(hoverEvent.value(), context) )); }); }
private <B extends BuildableComponent.Builder<?, ?>> void mergeStyle(final Component component, final B builder, final C context) { builder.mergeColor(component); builder.mergeDecorations(component); builder.clickEvent(component.clickEvent()); Optional.ofNullable(component.hoverEvent()).ifPresent(hoverEvent -> { builder.hoverEvent(new HoverEvent( hoverEvent.action(), this.render(hoverEvent.value(), context) )); }); }
/** * Merges the events from another component into this component. * * @param that the other component * @return this builder */ default @NonNull B mergeEvents(final @NonNull Component that) { if(that.clickEvent() != null) this.clickEvent(that.clickEvent()); if(that.hoverEvent() != null) this.hoverEvent(that.hoverEvent().copy()); // hard copy, hover events have a component return (B) this; }