Interface Expansion
public sealed interface Expansion
Expansion that contains placeholders
Usage Example:
Player player = event.getPlayer();
Expansion.Builder builder = Expansion.builder("player")
.resolver(Player.class, "name", (p, queue, ctx) -> Tag.selfClosingInserting(Component.text(p.getUsername()))
.build();
Expansion expansion = builder.build();
// You can also call the register() method to register
// the Expansion in the MiniPlaceholders global Extensions and
// use it in MiniPlaceholders.audiencePlaceholders() e.g.
TagResolver resolver = expansion.resolver();
player.sendMessage(MiniMessage.miniMessage().deserialize("Hello <luckperms_prefix> <player_name>", player, resolver));
- Since:
- 1.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionGet an Audience Placeholder by nameGet theTagResolverof anAudienceauthor()Get the author of this expansionstatic Expansion.BuilderCreates a new Expansion BuilderGet a Global Placeholder by nameGet global placeholdersdefault booleanhasAudiencePlaceholder(String name) Checks whether an audience placeholder with the specified name has been registered in this expansion.default booleanhasGlobalPlaceholder(String name) Checks whether a global placeholder with the specified name has been registered in this expansion.default booleanChecks whether a relational placeholder with the specified name has been registered in this expansion.name()Get the expansion nameGet a TagResolver that contains all placeholders of a specific type in this expansion.voidregister()Register this expansionbooleanGet the registration status of this expansionGet the registered audience placeholdersGet the registered relational placeholdersGet a Relational Placeholder by nameGet the relational placeholders based on two audiencesdefault StringDeprecated, for removal: This API element is subject to removal in a future version.Starting with MiniPlaceholders 3.1, the way loaded expansions are displayed in the console has changed, so this method is no longer usedvoidUnregisters this expansionversion()Get the version of this expansion
-
Method Details
-
name
-
author
-
version
-
audiencePlaceholders
TagResolver audiencePlaceholders()Get theTagResolverof anAudience- Returns:
- A TagResolver with variable placeholders of an Audience
- Since:
- 1.0.0
-
relationalPlaceholders
TagResolver relationalPlaceholders()Get the relational placeholders based on two audiencesThe resulting TagResolver will give results according to the 2
Audienceprovided and when called at any time will retrieve the required values- Returns:
- A TagResolver with variable placeholders between 2
Audiences - Since:
- 1.0.0
-
globalPlaceholders
TagResolver globalPlaceholders()Get global placeholders- Returns:
- the global placeholders
- Since:
- 1.0.0
-
register
void register()Register this expansion- Throws:
IllegalStateException- if the expansion you are trying to register is already registered- Since:
- 1.0.0
- See Also:
-
unregister
void unregister()Unregisters this expansion- Throws:
IllegalStateException- if the expansion you are trying to unregister is not registered- Since:
- 2.1.0
- See Also:
-
registered
boolean registered()Get the registration status of this expansion- Returns:
- true if the expansion is registered, otherwise false
- Since:
- 2.1.0
-
registeredAudiencePlaceholders
Collection<AudiencePlaceholder<?>> registeredAudiencePlaceholders()Get the registered audience placeholders- Returns:
- registered audience placeholders
-
registeredRelationalPlaceholders
Collection<RelationalPlaceholder<?>> registeredRelationalPlaceholders()Get the registered relational placeholders- Returns:
- registered relational placeholders
-
audiencePlaceholderByName
Get an Audience Placeholder by nameExpansion expansion = MiniPlaceholders.expansionByName("player") AudiencePlaceholder<?> placeholder = expansion.audiencePlaceholderByName("name");- Parameters:
name- the name of the placeholder to search- Returns:
- the desired placeholder or null
-
relationalPlaceholderByName
Get a Relational Placeholder by nameExpansion expansion = MiniPlaceholders.expansionByName("expansion") RelationalPlaceholder<?> placeholder = expansion.relationalPlaceholderByName("placeholder");- Parameters:
name- the name of the placeholder to search- Returns:
- the desired placeholder or null
- API Note:
- The name of a relational placeholder does not contain the prefix “rel”, just the name assigned when it was created
-
globalPlaceholderByName
Get a Global Placeholder by nameExpansion expansion = MiniPlaceholders.expansionByName("player") GlobalPlaceholder placeholder = expansion.globalPlaceholderByName("name");- Parameters:
name- the name of the placeholder to search- Returns:
- the desired placeholder or null
-
hasAudiencePlaceholder
Checks whether an audience placeholder with the specified name has been registered in this expansion.- Parameters:
name- the name of the placeholder to check- Returns:
- true if the placeholder is registered, else false
-
hasRelationalPlaceholder
Checks whether a relational placeholder with the specified name has been registered in this expansion.- Parameters:
name- the name of the placeholder to check- Returns:
- true if the placeholder is registered, else false
-
hasGlobalPlaceholder
Checks whether a global placeholder with the specified name has been registered in this expansion.- Parameters:
name- the name of the placeholder to check- Returns:
- true if the placeholder is registered, else false
-
placeholdersByType
Get a TagResolver that contains all placeholders of a specific type in this expansion.- Parameters:
type- the desired type- Returns:
- a TagResolver containing all placeholder of a specific type
-
builder
Creates a new Expansion Builder- Parameters:
name- the expansion name- Returns:
- a new expansion builder
- Since:
- 1.0.0
-
shortToString
Deprecated, for removal: This API element is subject to removal in a future version.Starting with MiniPlaceholders 3.1, the way loaded expansions are displayed in the console has changed, so this method is no longer usedGet a shorter ToString with the details of this expansion.- Returns:
- a shorter ToString
-