Interface Expansion.Builder
- All Superinterfaces:
AbstractBuilder<Expansion>
- Enclosing interface:
Expansion
Example use:
Expansion.Builder builder = Expansion.builder("player"); builder // Thanks to this filter, a cast can be performed without the probability of a ClassCastException .filter(Player.class) .resolver("name", (audience, queue, ctx) -> Tag.selfClosingInserting(Component.text(((Player)audience).getUsername()))); Expansion expansion = builder.build();then use it:
Player player = event.getPlayer();
TagResolver resolver = expansion.resolver(player);
Component messageReplaced = MiniMessage.deserialize(String
, resolver);
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescription<A extends Audience>
Expansion.BuilderaudiencePlaceholder
(@Nullable Class<A> targetClass, String key, AudienceTagResolver<A> audiencePlaceholder) Adds an audience placeholderdefault Expansion.Builder
audiencePlaceholder
(String key, AudienceTagResolver<Audience> audiencePlaceholder) Adds an audience placeholder@NotNull Expansion.Builder
Sets the author of this expansionglobalPlaceholder
(String key, GlobalTagResolver resolver) Adds a global placeholderdefault Expansion.Builder
globalPlaceholder
(String key, Tag tag) Adds a global placeholder<A extends Audience>
Expansion.BuilderrelationalPlaceholder
(@Nullable Class<A> targetClass, String key, RelationalTagResolver<A> relationalPlaceholder) Adds a Relational Placeholder based on two audiencesdefault Expansion.Builder
relationalPlaceholder
(String key, RelationalTagResolver<Audience> relationalResolver) Adds a Relational Placeholder based on two audiences@NotNull Expansion.Builder
Sets the version of this expansionMethods inherited from interface net.kyori.adventure.builder.AbstractBuilder
build
-
Method Details
-
audiencePlaceholder
<A extends Audience> Expansion.Builder audiencePlaceholder(@Nullable @Nullable Class<A> targetClass, String key, AudienceTagResolver<A> audiencePlaceholder) Adds an audience placeholderThis type of Placeholder depends on a specific audience to obtain its values
The content of this Placeholder is cached and can mutate depending on when it is invoked
- Type Parameters:
A
- the type of audience that this placeholder supports, must be the same as targetClass- Parameters:
targetClass
- the target classkey
- the placeholder key, cannot be an empty or black stringaudiencePlaceholder
- the single placeholder- Returns:
- the
Expansion.Builder
itself - Since:
- 1.0.0
-
audiencePlaceholder
default Expansion.Builder audiencePlaceholder(String key, AudienceTagResolver<Audience> audiencePlaceholder) Adds an audience placeholderThis type of Placeholder depends on a specific audience to obtain its values
The content of this Placeholder is cached and can mutate depending on when it is invoked
- Parameters:
key
- the placeholder key, cannot be an empty or black stringaudiencePlaceholder
- the single placeholder- Returns:
- the
Expansion.Builder
itself - Since:
- 3.0.0
-
relationalPlaceholder
<A extends Audience> Expansion.Builder relationalPlaceholder(@Nullable @Nullable Class<A> targetClass, String key, RelationalTagResolver<A> relationalPlaceholder) Adds a Relational Placeholder based on two audiencesThis type of placeholder allows you to create components based on a 2-audiences relationship, one is the one on which the placeholder is based and the other is the one on which the placeholder is displayed.
The content of this Placeholder is cached and can mutate depending on when it is invoked
- Type Parameters:
A
- the type of audience that this placeholder supports, must be the same as targetClass- Parameters:
targetClass
- the target classkey
- the placeholder key, cannot be an empty or black stringrelationalPlaceholder
- the relational placeholder- Returns:
- the
Expansion.Builder
itself - Since:
- 3.0.0
-
relationalPlaceholder
default Expansion.Builder relationalPlaceholder(String key, RelationalTagResolver<Audience> relationalResolver) Adds a Relational Placeholder based on two audiencesThis type of placeholder allows you to create components based on a 2-audiences relationship, one is the one on which the placeholder is based and the other is the one on which the placeholder is displayed.
The content of this Placeholder is cached and can mutate depending on when it is invoked
- Parameters:
key
- the placeholder key, cannot be an empty or black stringrelationalResolver
- the relational placeholder- Returns:
- the
Expansion.Builder
itself - Since:
- 3.0.0
-
globalPlaceholder
Adds a global placeholderThe content of this Placeholder is cached and can mutate depending on when it is invoked
- Parameters:
key
- the placeholder key, cannot be an empty or black stringresolver
- the function- Returns:
- the
Expansion.Builder
itself - Since:
- 3.0.0
-
globalPlaceholder
Adds a global placeholderThis placeholder is not cached and is immutable
- Parameters:
key
- the placeholder key, cannot be an empty or black stringtag
- the tag of this placeholder- Returns:
- the
Expansion.Builder
itself - Since:
- 1.1.0
-
author
@Contract("_ -> this") @NotNull @NotNull Expansion.Builder author(@Nullable @Nullable String author) Sets the author of this expansion- Parameters:
author
- the author of this expansion- Returns:
- the
Expansion.Builder
itself - Since:
- 2.3.0
-
version
@Contract("_ -> this") @NotNull @NotNull Expansion.Builder version(@Nullable @Nullable String version) Sets the version of this expansion- Parameters:
version
- the version of this expansion- Returns:
- the
Expansion.Builder
itself - Since:
- 2.3.0
-