@NullMarked
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 theregister()
method to register // theExpansion
in theMiniPlaceholders
global Extensions and // use it inMiniPlaceholders.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 TypeMethodDescription@Nullable AudiencePlaceholder
<?> Get an Audience Placeholder by nameGet theTagResolver
of anAudience
@Nullable String
author()
Get the author of this expansionstatic Expansion.Builder
Creates a new Expansion Builder@Nullable GlobalPlaceholder
Get a Global Placeholder by nameGet global placeholdersdefault boolean
hasAudiencePlaceholder
(String name) Checks whether an audience placeholder with the specified name has been registered in this expansion.default boolean
hasGlobalPlaceholder
(String name) Checks whether a global placeholder with the specified name has been registered in this expansion.default boolean
Checks 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.void
register()
Register this expansionboolean
Get the registration status of this expansionGet the registered audience placeholdersGet the registered relational placeholders@Nullable RelationalPlaceholder
<?> Get a Relational Placeholder by nameGet the relational placeholders based on two audiencesdefault String
Get a shorter ToString with the details of this expansion.void
Unregisters this expansion@Nullable String
version()
Get the version of this expansion
-
Method Details
-
name
String name()Get the expansion name- Returns:
- the expansion name
- Since:
- 1.0.0
-
author
Get the author of this expansion- Returns:
- the author or null
- Since:
- 2.3.0
-
version
Get the version of this expansion- Returns:
- the version or null
- Since:
- 2.3.0
-
audiencePlaceholders
TagResolver audiencePlaceholders()Get theTagResolver
of 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
Audience
provided and when called at any time will retrieve the required values- Returns:
- A TagResolver with variable placeholders between 2
Audience
s - 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
Get a shorter ToString with the details of this expansion.- Returns:
- a shorter ToString
-