java.lang.Object
io.github.miniplaceholders.api.MiniPlaceholders
MiniPlaceholders, a component-based placeholders API.
This class allows you to obtain the TagResolver
that other plugins provide based on single Audience
,
2-audience or global placeholders
- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic TagResolver
Get a TagResolver that can obtain data based on a relationship of 2 audiences and at the same time from the main audience and global placeholders.static TagResolver
Gets the TagResolver that can get data from an Audience.static @Nullable Expansion
expansionByName
(String name) Get a specific expansion by namestatic int
Get the amount of expansion registered.static @Unmodifiable Collection
<Expansion> Obtain all available registered expansionsstatic TagResolver
Get the global placeholdersstatic TagResolver
Get a TagResolver based on the desired placeholder type.static Platform
platform()
Get the platform on which MiniPlaceholders is running.static TagResolver
Get the relational placeholders based on two audiences, based on the first audience, and the global placeholdersstatic TagResolver
Get the relational placeholders based on two audiences
The audiences are provided at the time of parsing from the respective MiniMessage instance through the use of aRelationalAudience
.
-
Method Details
-
platform
Get the platform on which MiniPlaceholders is running.- Returns:
- the platform
- Since:
- 3.0.0
-
globalPlaceholders
Get the global placeholdersTagResolver resolver = MiniPlaceholders.globalPlaceholders(); Component messageParsed = MiniMessage.miniMessage().deserialize(
String
, resolver);- Returns:
- global placeholders independent of any audience
- Since:
- 3.0.0
- See Also:
-
audiencePlaceholders
Gets the TagResolver that can get data from an Audience.
The audience is provided at the time of parsing from the respective MiniMessage instance.TagResolver resolver = MiniPlaceholders.audiencePlaceholders(); Component messageParsed = MiniMessage.miniMessage().deserialize(
String
,Audience
, resolver);- Returns:
TagResolver
with placeholders based on an audience- Since:
- 3.0.0
-
relationalPlaceholders
Get the relational placeholders based on two audiences
The audiences are provided at the time of parsing from the respective MiniMessage instance through the use of aRelationalAudience
.TagResolver resolver = MiniPlaceholders.relationalPlaceholders(); Component parsed = MiniMessage.miniMessage().deserialize(@link String, {@link RelationalAudience}, resolver);
- Returns:
- placeholders based on two audiences
- Since:
- 3.0.0
- See Also:
-
audienceGlobalPlaceholders
Get a TagResolver that can obtain data based on a relationship of 2 audiences and at the same time from the main audience and global placeholders.
The audience is provided at the time of parsing from the respective MiniMessage instance.TagResolver resolver = MiniPlaceholders.audienceGlobalPlaceholders(); TagResolver resolver2 = TagResolver.resolver( MiniPlaceholders.audienceGlobalPlaceholders(), MiniPlaceholders.globalPlaceholders() ); // This two resolvers returns the same TagResolver assertEquals(resolver, resolver2); Component parsed = MiniMessage.miniMessage().deserialize(
String
,Audience
, resolver);- Returns:
TagResolver
with placeholders based on an audience and the global placeholders- Since:
- 1.1.0
-
relationalGlobalPlaceholders
Get the relational placeholders based on two audiences, based on the first audience, and the global placeholdersTagResolver resolver = MiniPlaceholders.relationalGlobalPlaceholders(); TagResolver resolver2 = TagResolver.resolver( MiniPlaceholders.relationalPlaceholders(), MiniPlaceholders.audiencePlaceholders(), MiniPlaceholders.globalPlaceholders() ); // This methods should return the same TagResolver assertEquals(resolver, resolver2); Component messageParsed = MiniMessage.miniMessage().deserialize(
String
,RelationalAudience
, resolver);- Returns:
- the placeholders based on two audiences, placeholders based on the first audience and the global placeholders
- Since:
- 3.0.0
- See Also:
- API Note:
- In the case of audience placeholders, the audience to be used will be the
RelationalAudience.audience()
-
placeholdersByType
Get a TagResolver based on the desired placeholder type.
PlaceholderType.GLOBAL
will returnglobalPlaceholders()
PlaceholderType.AUDIENCE
will returnaudiencePlaceholders()
PlaceholderType.RELATIONAL
will returnrelationalPlaceholders()
- Parameters:
type
- the desired type- Returns:
- the TagResolvers from the respective type
- See Also:
-
expansionCount
public static int expansionCount()Get the amount of expansion registered.- Returns:
- the amount of expansions registered
- Since:
- 3.0.0
-
expansionByName
Get a specific expansion by nameThe name of each expansion is set when the expansion is created
Expansion expansion = Expansion.builder("example").build(); expansion.register(); assertThat(MiniPlaceholders.expansionByName("example")).isNotNull();
- Parameters:
name
- the name of the required expansion- Returns:
- the required expansion, if not present, will return null
- Since:
- 3.0.0
- See Also:
-
expansionsAvailable
Obtain all available registered expansions- Returns:
- all available registered expansions
- Since:
- 3.0.0
-