Package net.kyori.adventure.text
Interface TextReplacementConfig.Builder
- All Superinterfaces:
- Buildable.Builder<TextReplacementConfig>
- Enclosing interface:
- TextReplacementConfig
public static interface TextReplacementConfig.Builder extends Buildable.Builder<TextReplacementConfig>
A builder for replacement configurations.
- Since:
- 4.2.0
- 
Method SummaryModifier and Type Method Description @NonNull TextReplacementConfig.Buildercondition(@NonNull IntFunction2<PatternReplacementResult> condition)Set the function to determine how an individual match should be processed.default @NonNull TextReplacementConfig.Buildermatch(@NonNull @Regex String pattern)Compile the provided input as aPatternand match against it.@NonNull TextReplacementConfig.Buildermatch(@NonNull Pattern pattern)Match the providedPattern.default TextReplacementConfig.BuildermatchLiteral(String literal)Match against the literal string provided.default @NonNull TextReplacementConfig.Builderonce()Only replace the first occurrence of the matched pattern.default @NonNull TextReplacementConfig.Builderreplacement(@NonNull String replacement)Supply a literal replacement for the matched pattern.@NonNull TextReplacementConfig.Builderreplacement(@NonNull BiFunction<MatchResult,TextComponent.Builder,@Nullable ComponentLike> replacement)Supply a function that provides replacements for each match, with access to group information.default @NonNull TextReplacementConfig.Builderreplacement(@NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Supply a function that provides replacements for each match.default @NonNull TextReplacementConfig.Builderreplacement(@Nullable ComponentLike replacement)Supply a literal replacement for the matched pattern.default @NonNull TextReplacementConfig.Buildertimes(int times)Only replace the firsttimesmatches of the pattern.
- 
Method Details- 
matchLiteralMatch against the literal string provided.This will NOT be parsed as a regular expression. - Parameters:
- literal- the literal string to match
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
matchCompile the provided input as aPatternand match against it.- Parameters:
- pattern- the regex pattern to match
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
matchMatch the providedPattern.- Parameters:
- pattern- pattern to find in any searched components
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
onceOnly replace the first occurrence of the matched pattern.- Returns:
- this builder
- Since:
- 4.2.0
 
- 
timesOnly replace the firsttimesmatches of the pattern.- Parameters:
- times- maximum amount of matches to process
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
condition@NonNull TextReplacementConfig.Builder condition(@NonNull IntFunction2<PatternReplacementResult> condition)Set the function to determine how an individual match should be processed.- Parameters:
- condition- a function of- (index, replaced)used to determine if matches should be replaced, where "replaced" is the number of successful replacements.
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
replacementSupply a literal replacement for the matched pattern.- Parameters:
- replacement- the replacement
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
replacementSupply a literal replacement for the matched pattern.- Parameters:
- replacement- the replacement
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
replacementdefault @NonNull TextReplacementConfig.Builder replacement(@NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Supply a function that provides replacements for each match.- Parameters:
- replacement- the replacement function
- Returns:
- this builder
- Since:
- 4.2.0
 
- 
replacement@NonNull TextReplacementConfig.Builder replacement(@NonNull BiFunction<MatchResult,TextComponent.Builder,@Nullable ComponentLike> replacement)Supply a function that provides replacements for each match, with access to group information.- Parameters:
- replacement- the replacement function, taking a match result and a text component pre-populated with
- Returns:
- this builder
- Since:
- 4.2.0
 
 
-