Interface ComponentBuilder<C extends BuildableComponent<C,​B>,​B extends ComponentBuilder<C,​B>>

    • Method Detail

      • append

        @Contract("_ -> this")
        @NotNull
        B append​(@NotNull
                 @NotNull Component component)
        Appends a component to this component.
        Parameters:
        component - the component to append
        Returns:
        this builder
        Since:
        4.0.0
      • append

        @Contract("_ -> this")
        @NotNull
        default B append​(@NotNull
                         @NotNull ComponentLike component)
        Appends a component to this component.
        Parameters:
        component - the component to append
        Returns:
        this builder
        Since:
        4.0.0
      • append

        @Contract("_ -> this")
        @NotNull
        default B append​(@NotNull
                         @NotNull ComponentBuilder<?,​?> builder)
        Appends a component to this component.
        Parameters:
        builder - the component to append
        Returns:
        this builder
        Since:
        4.0.0
      • append

        @Contract("_ -> this")
        @NotNull
        B append​(@NotNull
                 @NotNull Component @NotNull ... components)
        Appends components to this component.
        Parameters:
        components - the components to append
        Returns:
        this builder
        Since:
        4.0.0
      • append

        @Contract("_ -> this")
        @NotNull
        B append​(@NotNull
                 @NotNull ComponentLike @NotNull ... components)
        Appends components to this component.
        Parameters:
        components - the components to append
        Returns:
        this builder
        Since:
        4.0.0
      • append

        @Contract("_ -> this")
        @NotNull
        B append​(@NotNull
                 @NotNull Iterable<? extends ComponentLike> components)
        Appends components to this component.
        Parameters:
        components - the components to append
        Returns:
        this builder
        Since:
        4.0.0
      • apply

        @Contract("_ -> this")
        @NotNull
        default B apply​(@NotNull
                        @NotNull Consumer<? super ComponentBuilder<?,​?>> consumer)
        Applies an action to this builder.
        Parameters:
        consumer - the action
        Returns:
        this builder
        Since:
        4.0.0
      • applyDeep

        @Contract("_ -> this")
        @NotNull
        B applyDeep​(@NotNull
                    @NotNull Consumer<? super ComponentBuilder<?,​?>> action)
        Applies an action to this component and all child components if they are an instance of BuildableComponent.
        Parameters:
        action - the action
        Returns:
        this builder
        Since:
        4.0.0
      • mapChildren

        @Contract("_ -> this")
        @NotNull
        B mapChildren​(@NotNull
                      @NotNull Function<BuildableComponent<?,​?>,​? extends BuildableComponent<?,​?>> function)
        Replaces each child of this component with the resultant component from the function.
        Parameters:
        function - the mapping function
        Returns:
        this builder
        Since:
        4.0.0
      • mapChildrenDeep

        @Contract("_ -> this")
        @NotNull
        B mapChildrenDeep​(@NotNull
                          @NotNull Function<BuildableComponent<?,​?>,​? extends BuildableComponent<?,​?>> function)
        Replaces each child and sub-child of this component with the resultant component of the function.
        Parameters:
        function - the mapping function
        Returns:
        this builder
        Since:
        4.0.0
      • children

        @NotNull
        @NotNull List<Component> children()
        Get an unmodifiable list containing all children currently in this builder.
        Returns:
        the list of children
        Since:
        4.6.0
      • style

        @Contract("_ -> this")
        @NotNull
        B style​(@NotNull
                @NotNull Style style)
        Sets the style.
        Parameters:
        style - the style
        Returns:
        this builder
        Since:
        4.0.0
      • style

        @Contract("_ -> this")
        @NotNull
        B style​(@NotNull
                @NotNull Consumer<Style.Builder> consumer)
        Configures the style.
        Parameters:
        consumer - the style consumer
        Returns:
        this builder
        Since:
        4.0.0
      • font

        @Contract("_ -> this")
        @NotNull
        B font​(@Nullable
               @Nullable Key font)
        Sets the font of this component.
        Parameters:
        font - the font
        Returns:
        this builder
        Since:
        4.0.0
      • color

        @Contract("_ -> this")
        @NotNull
        B color​(@Nullable
                @Nullable TextColor color)
        Sets the color of this component.
        Parameters:
        color - the color
        Returns:
        this builder
        Since:
        4.0.0
      • colorIfAbsent

        @Contract("_ -> this")
        @NotNull
        B colorIfAbsent​(@Nullable
                        @Nullable TextColor color)
        Sets the color of this component if there isn't one set already.
        Parameters:
        color - the color
        Returns:
        this builder
        Since:
        4.0.0
      • decorations

        @Contract("_, _ -> this")
        @NotNull
        default B decorations​(@NotNull
                              @NotNull Set<TextDecoration> decorations,
                              boolean flag)
        Sets the state of a set of decorations to flag on this component.
        Parameters:
        decorations - the decorations
        flag - true if this component should have the decorations, false if this component should not have the decorations
        Returns:
        this builder
        Since:
        4.0.0
      • decorate

        @Contract("_ -> this")
        @NotNull
        default B decorate​(@NotNull
                           @NotNull TextDecoration decoration)
        Sets the state of decoration to TextDecoration.State.TRUE.
        Parameters:
        decoration - the decoration
        Returns:
        this builder
        Since:
        4.0.0
      • decorate

        @Contract("_ -> this")
        @NotNull
        default B decorate​(@NotNull
                           @NotNull TextDecoration @NotNull ... decorations)
        Sets decorations to TextDecoration.State.TRUE.
        Parameters:
        decorations - the decorations
        Returns:
        this builder
        Since:
        4.0.0
      • decoration

        @Contract("_, _ -> this")
        @NotNull
        default B decoration​(@NotNull
                             @NotNull TextDecoration decoration,
                             boolean flag)
        Sets the state of a decoration on this component.
        Parameters:
        decoration - the decoration
        flag - true if this component should have the decoration, false if this component should not have the decoration
        Returns:
        this builder
        Since:
        4.0.0
      • clickEvent

        @Contract("_ -> this")
        @NotNull
        B clickEvent​(@Nullable
                     @Nullable ClickEvent event)
        Sets the click event of this component.
        Parameters:
        event - the click event
        Returns:
        this builder
        Since:
        4.0.0
      • hoverEvent

        @Contract("_ -> this")
        @NotNull
        B hoverEvent​(@Nullable
                     @Nullable HoverEventSource<?> source)
        Sets the hover event of this component.
        Parameters:
        source - the hover event source
        Returns:
        this builder
        Since:
        4.0.0
      • insertion

        @Contract("_ -> this")
        @NotNull
        B insertion​(@Nullable
                    @Nullable String insertion)
        Sets the string to be inserted when this component is shift-clicked.
        Parameters:
        insertion - the insertion string
        Returns:
        this builder
        Since:
        4.0.0
      • mergeStyle

        @Contract("_ -> this")
        @NotNull
        default B mergeStyle​(@NotNull
                             @NotNull Component that)
        Merges styling from another component into this component.
        Parameters:
        that - the other component
        Returns:
        this builder
        Since:
        4.0.0
      • mergeStyle

        @Contract("_, _ -> this")
        @NotNull
        default B mergeStyle​(@NotNull
                             @NotNull Component that,
                             @NotNull Style.Merge @NotNull ... merges)
        Merges styling from another component into this component.
        Parameters:
        that - the other component
        merges - the parts to merge
        Returns:
        this builder
        Since:
        4.0.0
      • mergeStyle

        @Contract("_, _ -> this")
        @NotNull
        B mergeStyle​(@NotNull
                     @NotNull Component that,
                     @NotNull
                     @NotNull Set<Style.Merge> merges)
        Merges styling from another component into this component.
        Parameters:
        that - the other component
        merges - the parts to merge
        Returns:
        this builder
        Since:
        4.0.0
      • resetStyle

        @NotNull
        B resetStyle()
        Resets all styling on this component.
        Returns:
        this builder
        Since:
        4.0.0
      • applicableApply

        @Contract("_ -> this")
        @NotNull
        default B applicableApply​(@NotNull
                                  @NotNull ComponentBuilderApplicable applicable)
        Applies applicable.
        Parameters:
        applicable - the thing to apply
        Returns:
        this builder
        Since:
        4.0.0