Interface ScopedComponent<C extends Component>

Type Parameters:
C - the component type
All Superinterfaces:
Component, ComponentBuilderApplicable, ComponentLike, net.kyori.examination.Examinable, HoverEventSource<Component>, StyleGetter, StyleSetter<Component>
All Known Subinterfaces:
BlockNBTComponent, EntityNBTComponent, KeybindComponent, ScoreComponent, SelectorComponent, StorageNBTComponent, TextComponent, TranslatableComponent, VirtualComponent

public interface ScopedComponent<C extends Component> extends Component
Some magic to change return types.
Since:
4.0.0
  • Method Details

    • asComponent

      @NotNull default C asComponent()
      Description copied from interface: ComponentLike
      Gets a Component representation.
      Specified by:
      asComponent in interface Component
      Specified by:
      asComponent in interface ComponentLike
      Returns:
      a component
    • children

      @NotNull C children(@NotNull @NotNull List<? extends ComponentLike> children)
      Description copied from interface: Component
      Sets the list of children.

      The contents of children will be copied.

      Specified by:
      children in interface Component
      Parameters:
      children - the children
      Returns:
      a component with the children set
    • style

      @NotNull C style(@NotNull @NotNull Style style)
      Description copied from interface: Component
      Sets the style of this component.
      Specified by:
      style in interface Component
      Parameters:
      style - the style
      Returns:
      a component
    • style

      @NotNull default C style(@NotNull @NotNull Consumer<Style.Builder> style)
      Description copied from interface: Component
      Sets the style of this component.
      Specified by:
      style in interface Component
      Parameters:
      style - the style consumer
      Returns:
      a component
    • style

      @NotNull default C style(@NotNull Style.Builder style)
      Description copied from interface: Component
      Sets the style of this component.
      Specified by:
      style in interface Component
      Parameters:
      style - the style
      Returns:
      a component
    • style

      @NotNull default C style(@NotNull @NotNull Consumer<Style.Builder> consumer, @NotNull Style.Merge.Strategy strategy)
      Description copied from interface: Component
      Sets the style of this component.
      Specified by:
      style in interface Component
      Parameters:
      consumer - the style consumer
      strategy - the merge strategy
      Returns:
      a component
    • mergeStyle

      @NotNull default C mergeStyle(@NotNull @NotNull Component that)
      Description copied from interface: Component
      Merges from another style into this component's style.
      Specified by:
      mergeStyle in interface Component
      Parameters:
      that - the other style
      Returns:
      a component
    • mergeStyle

      @NotNull default C mergeStyle(@NotNull @NotNull Component that, @NotNull Style.Merge @NotNull ... merges)
      Description copied from interface: Component
      Merges from another style into this component's style.
      Specified by:
      mergeStyle in interface Component
      Parameters:
      that - the other style
      merges - the style parts to merge
      Returns:
      a component
    • append

      @NotNull default C append(@NotNull @NotNull Component component)
      Description copied from interface: Component
      Appends a component to this component.
      Specified by:
      append in interface Component
      Parameters:
      component - the component to append
      Returns:
      a component with the component added
    • append

      @NotNull default C append(@NotNull @NotNull ComponentLike like)
      Description copied from interface: Component
      Appends a component to this component.
      Specified by:
      append in interface Component
      Parameters:
      like - the component to append
      Returns:
      a component with the component added
    • append

      @NotNull default C append(@NotNull @NotNull ComponentBuilder<?,?> builder)
      Description copied from interface: Component
      Appends a component to this component.
      Specified by:
      append in interface Component
      Parameters:
      builder - the component to append
      Returns:
      a component with the component added
    • appendNewline

      @NotNull default C appendNewline()
      Description copied from interface: Component
      Appends a newline to this component.
      Specified by:
      appendNewline in interface Component
      Returns:
      a component with the newline added
    • appendSpace

      @NotNull default C appendSpace()
      Description copied from interface: Component
      Appends a space to this component.
      Specified by:
      appendSpace in interface Component
      Returns:
      a component with the space added
    • applyFallbackStyle

      @NotNull default C applyFallbackStyle(@NotNull @NotNull StyleBuilderApplicable @NotNull ... style)
      Description copied from interface: Component
      Apply a fallback style for this component and its children.

      This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.

      Specified by:
      applyFallbackStyle in interface Component
      Parameters:
      style - style to be used as a fallback
      Returns:
      the styled component
    • applyFallbackStyle

      @NotNull default C applyFallbackStyle(@NotNull @NotNull Style style)
      Description copied from interface: Component
      Apply a fallback style for this component and its children.

      This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.

      Specified by:
      applyFallbackStyle in interface Component
      Parameters:
      style - style to be used as a fallback
      Returns:
      the styled component
    • mergeStyle

      @NotNull default C mergeStyle(@NotNull @NotNull Component that, @NotNull @NotNull Set<Style.Merge> merges)
      Description copied from interface: Component
      Merges from another style into this component's style.
      Specified by:
      mergeStyle in interface Component
      Parameters:
      that - the other style
      merges - the style parts to merge
      Returns:
      a component
    • color

      @NotNull default C color(@Nullable @Nullable TextColor color)
      Description copied from interface: Component
      Sets the color of this component.
      Specified by:
      color in interface Component
      Specified by:
      color in interface StyleSetter<C extends Component>
      Parameters:
      color - the color
      Returns:
      a component
    • colorIfAbsent

      @NotNull default C colorIfAbsent(@Nullable @Nullable TextColor color)
      Description copied from interface: Component
      Sets the color if there isn't one set already.
      Specified by:
      colorIfAbsent in interface Component
      Specified by:
      colorIfAbsent in interface StyleSetter<C extends Component>
      Parameters:
      color - the color
      Returns:
      a component
    • shadowColor

      @NotNull default C shadowColor(@Nullable @Nullable ARGBLike argb)
      Description copied from interface: Component
      Sets the shadow color of this component.
      Specified by:
      shadowColor in interface Component
      Specified by:
      shadowColor in interface StyleSetter<C extends Component>
      Parameters:
      argb - the color
      Returns:
      a component
    • shadowColorIfAbsent

      @NotNull default C shadowColorIfAbsent(@Nullable @Nullable ARGBLike argb)
      Description copied from interface: Component
      Sets the shadow color if there isn't one set already.
      Specified by:
      shadowColorIfAbsent in interface Component
      Specified by:
      shadowColorIfAbsent in interface StyleSetter<C extends Component>
      Parameters:
      argb - the color
      Returns:
      a component
    • decorate

      @NotNull default C decorate(@NotNull @NotNull TextDecoration decoration)
      Description copied from interface: Component
      Sets the state of decoration to TextDecoration.State.TRUE on this component.
      Specified by:
      decorate in interface Component
      Specified by:
      decorate in interface StyleSetter<C extends Component>
      Parameters:
      decoration - the decoration
      Returns:
      a component
    • decoration

      @NotNull default C decoration(@NotNull @NotNull TextDecoration decoration, boolean flag)
      Description copied from interface: Component
      Sets the state of a decoration on this component.
      Specified by:
      decoration in interface Component
      Specified by:
      decoration in interface StyleSetter<C extends Component>
      Parameters:
      decoration - the decoration
      flag - true if this component should have the decoration, false if this component should not have the decoration
      Returns:
      a component
    • decoration

      @NotNull default C decoration(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
      Description copied from interface: Component
      Sets the value of a decoration on this component.
      Specified by:
      decoration in interface Component
      Specified by:
      decoration in interface StyleSetter<C extends Component>
      Parameters:
      decoration - the decoration
      state - TextDecoration.State.TRUE if this component should have the decoration, TextDecoration.State.FALSE if this component should not have the decoration, and TextDecoration.State.NOT_SET if the decoration should not have a set value
      Returns:
      a component
    • decorationIfAbsent

      @NotNull default C decorationIfAbsent(@NotNull @NotNull TextDecoration decoration, @NotNull TextDecoration.State state)
      Description copied from interface: Component
      Sets the state of a decoration on this component to state if the current state of the decoration is TextDecoration.State.NOT_SET.
      Specified by:
      decorationIfAbsent in interface Component
      Specified by:
      decorationIfAbsent in interface StyleSetter<C extends Component>
      Parameters:
      decoration - the decoration
      state - the state
      Returns:
      a component
    • decorations

      @NotNull default C decorations(@NotNull @NotNull Map<TextDecoration,TextDecoration.State> decorations)
      Description copied from interface: Component
      Sets decorations for this component's style using the specified decorations map.

      If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed.

      Specified by:
      decorations in interface Component
      Specified by:
      decorations in interface StyleSetter<C extends Component>
      Parameters:
      decorations - a set of default values
      Returns:
      a component
    • clickEvent

      @NotNull default C clickEvent(@Nullable @Nullable ClickEvent event)
      Description copied from interface: Component
      Sets the click event of this component.
      Specified by:
      clickEvent in interface Component
      Specified by:
      clickEvent in interface StyleSetter<C extends Component>
      Parameters:
      event - the click event
      Returns:
      a component
    • hoverEvent

      @NotNull default C hoverEvent(@Nullable @Nullable HoverEventSource<?> event)
      Description copied from interface: Component
      Sets the hover event of this component.
      Specified by:
      hoverEvent in interface Component
      Specified by:
      hoverEvent in interface StyleSetter<C extends Component>
      Parameters:
      event - the hover event source
      Returns:
      a component
    • insertion

      @NotNull default C insertion(@Nullable @Nullable String insertion)
      Description copied from interface: Component
      Sets the string to be inserted when this component is shift-clicked.
      Specified by:
      insertion in interface Component
      Specified by:
      insertion in interface StyleSetter<C extends Component>
      Parameters:
      insertion - the insertion string
      Returns:
      a component
    • font

      @NotNull default C font(@Nullable @Nullable Key key)
      Description copied from interface: Component
      Sets the font.
      Specified by:
      font in interface Component
      Specified by:
      font in interface StyleSetter<C extends Component>
      Parameters:
      key - a font
      Returns:
      a component