Interface AudienceProvider.Builder<P extends AudienceProvider,B extends AudienceProvider.Builder<P,B>>
-
- Enclosing interface:
- AudienceProvider
public static interface AudienceProvider.Builder<P extends AudienceProvider,B extends AudienceProvider.Builder<P,B>>A builder forAudienceProvider.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Pbuild()Builds the provider.default <T> BcomponentRenderer(@NotNull Function<net.kyori.adventure.pointer.Pointered,T> partition, @NotNull net.kyori.adventure.text.renderer.ComponentRenderer<T> componentRenderer)Sets the component renderer and partition function for the provider.BcomponentRenderer(@NotNull net.kyori.adventure.text.renderer.ComponentRenderer<net.kyori.adventure.pointer.Pointered> componentRenderer)Sets the component renderer for the provider.Bpartition(@NotNull Function<net.kyori.adventure.pointer.Pointered,?> partitionFunction)Set the partition function for the provider.
-
-
-
Method Detail
-
componentRenderer
@NotNull B componentRenderer(@NotNull @NotNull net.kyori.adventure.text.renderer.ComponentRenderer<net.kyori.adventure.pointer.Pointered> componentRenderer)
Sets the component renderer for the provider.- Parameters:
componentRenderer- a component renderer- Returns:
- this builder
- Since:
- 4.0.0
- See Also:
componentRenderer(Function, ComponentRenderer)
-
partition
@NotNull B partition(@NotNull @NotNull Function<net.kyori.adventure.pointer.Pointered,?> partitionFunction)
Set the partition function for the provider.The output of the function must have
Object.equals(Object)andObject.hashCode()methods overridden to ensure efficient operation.The output of the partition function must also be something suitable for use as a map key and as such, for long-term storage. This excludes objects that may hold live game state like
EntityorLevel.The configured
component renderermust produce the same result for twoPointeredinstances where this partition function provides the same output. If this condition is violated, caching issues are likely to occur, producing incorrect output for at least one of the inputs.A local
recordis a good way to produce a compound output value for this function.- Parameters:
partitionFunction- the partition function to apply- Returns:
- this builder
- Since:
- 4.0.0
- See Also:
componentRenderer(Function, ComponentRenderer)
-
componentRenderer
@NotNull default <T> B componentRenderer(@NotNull @NotNull Function<net.kyori.adventure.pointer.Pointered,T> partition, @NotNull @NotNull net.kyori.adventure.text.renderer.ComponentRenderer<T> componentRenderer)
Sets the component renderer and partition function for the provider.This variant validates that the component renderer only depends on information included in the partition.
- Parameters:
componentRenderer- a component renderer- Returns:
- this builder
- Since:
- 4.0.0
-
build
@NotNull P build()
Builds the provider.- Returns:
- the built provider
- Since:
- 4.0.0
-
-