Skip to content

Commit

Permalink
Merge pull request #924 from powercasgamer/feature/join-builder
Browse files Browse the repository at this point in the history
feat: add join method that accepts JoinConfiguration.Builder
  • Loading branch information
zml2008 committed Jun 4, 2023
2 parents eb75bbc + 6726ec5 commit d3c02fc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions api/src/main/java/net/kyori/adventure/text/Component.java
Expand Up @@ -192,6 +192,38 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex
return Component.text().append(component).build();
}

/**
* Joins {@code components} using the configuration in {@code configBuilder}.
*
* @param configBuilder the join configuration
* @param components the components
* @return the resulting component
* @see JoinConfiguration#noSeparators()
* @see JoinConfiguration#separator(ComponentLike)
* @see JoinConfiguration#separators(ComponentLike, ComponentLike)
* @since 4.14.0
*/
@Contract(pure = true)
static @NotNull Component join(final JoinConfiguration.@NotNull Builder configBuilder, final @NotNull ComponentLike@NotNull... components) {
return join(configBuilder, Arrays.asList(components));
}

/**
* Joins {@code components} using the configuration in {@code configBuilder}.
*
* @param configBuilder the join configuration
* @param components the components
* @return the resulting component
* @see JoinConfiguration#noSeparators()
* @see JoinConfiguration#separator(ComponentLike)
* @see JoinConfiguration#separators(ComponentLike, ComponentLike)
* @since 4.14.0
*/
@Contract(pure = true)
static @NotNull Component join(final JoinConfiguration.@NotNull Builder configBuilder, final @NotNull Iterable<? extends ComponentLike> components) {
return JoinConfigurationImpl.join(configBuilder.build(), components);
}

/**
* Joins {@code components} using the configuration in {@code config}.
*
Expand Down

0 comments on commit d3c02fc

Please sign in to comment.