@Contract(mutates = "param1")
  static <R, B extends AbstractBuilder<R>> @NotNull R configureAndBuild(final @NotNull B builder, final @Nullable Consumer<? super B> consumer) {
    if (consumer != null) {
      consumer.accept(builder);
    }
    return builder.build();
  }
Configures {@code builder} using {@code consumer} and then builds.

@param builder the builder
@param consumer the builder consume
@param <R> the type to be built
@param <B> the builder type
@return the built thing
@since 4.10.0
api/src/main/java/net/kyori/adventure/builder/AbstractBuilder.java