Class MiniPlaceholders

java.lang.Object
io.github.miniplaceholders.api.MiniPlaceholders

public final class MiniPlaceholders extends Object
MiniPlaceholders

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 Details

    • getPlatform

      @NotNull public static @NotNull Platform getPlatform()
      Get the platform
      Returns:
      the platform
      Since:
      1.0.0
    • getGlobalPlaceholders

      @NotNull public static @NotNull TagResolver getGlobalPlaceholders()
      Get the global placeholders
      TagResolver resolver = MiniPlaceholders.getGlobalPlaceholders();
       Component messageParsed = MiniMessage.miniMessage().deserialize(String, resolver);
      Returns:
      global placeholders independent of any audience
      Since:
      1.0.0
      See Also:
    • getAudiencePlaceholders

      @NotNull public static @NotNull TagResolver getAudiencePlaceholders(@NotNull @NotNull Audience audience)
      Get the TagResolver based on an Audience
      TagResolver resolver = MiniPlaceholders.getAudiencePlaceholders(Audience);
       Component messageParsed = MiniMessage.miniMessage().deserialize(String, resolver);
      Parameters:
      audience - the audience
      Returns:
      TagResolver with placeholders based on an audience
      Since:
      1.0.0
    • getRelationalPlaceholders

      @NotNull public static @NotNull TagResolver getRelationalPlaceholders(@NotNull @NotNull Audience audience, @NotNull @NotNull Audience otherAudience)
      Get the relational placeholders based on two audiences
      TagResolver resolver = MiniPlaceholders.getRelationalPlaceholders(Audience, Audience);
       Component messageParsed = MiniMessage.miniMessage().deserialize(String, resolver);
      Parameters:
      audience - an audience
      otherAudience - another audience
      Returns:
      placeholders based on two audiences
      Since:
      1.0.0
    • getAudienceGlobalPlaceholders

      @NotNull public static @NotNull TagResolver getAudienceGlobalPlaceholders(@NotNull @NotNull Audience audience)
      Get the TagResolver based on an Audience and the global placeholders
       TagResolver resolver = MiniPlaceholders.getAudienceGlobalPlaceholders(Audience);
       TagResolver resolver2 = TagResolver.resolver(
        MiniPlaceholders.getAudienceGlobalPlaceholders(Audience),
        MiniPlaceholders.getGlobalPlaceholders()
       );
       // This two resolvers returns the same TagResolver
       assertEquals(resolver, resolver2);
       Component messageParsed = MiniMessage.miniMessage().deserialize(String, resolver);
       
      Parameters:
      audience - the audience
      Returns:
      TagResolver with placeholders based on an audience and the global placeholders
      Since:
      1.1.0
    • getRelationalGlobalPlaceholders

      @NotNull public static @NotNull TagResolver getRelationalGlobalPlaceholders(@NotNull @NotNull Audience audience, @NotNull @NotNull Audience otherAudience)
      Get the relational placeholders based on two audiences, based on the first audience, and the global placeholders
       TagResolver resolver = MiniPlaceholders.getRelationalGlobalPlaceholders(Audience, Audience);
       TagResolver resolver2 = TagResolver.resolver(
        MiniPlaceholders.getRelationalPlaceholders(audience1, audience2),
        MiniPlaceholders.getAudiencePlaceholders(audience1),
        MiniPlaceholders.getGlobalPlaceholders()
       );
       // This methods should return the same TagResolver
       assertEquals(resolver, resolver2);
       Component messageParsed = MiniMessage.miniMessage().deserialize(String, resolver);
       
      Parameters:
      audience - an audience
      otherAudience - another audience
      Returns:
      the placeholders based on two audiences, placeholders based on the first audience and the global placeholders
      Since:
      1.1.0
    • getExpansionCount

      public static int getExpansionCount()
      Get the amount of expansion registered
      Returns:
      the amount of expansions registered
      Since:
      1.0.0
    • getExpansionByName

      @Nullable public static @Nullable Expansion getExpansionByName(@NotNull @NotNull String name)
      Get a specific expansion by name

      The name of each expansion is set when the expansion is created

           Expansion expansion = Expansion.builder("example").build();
           expansion.register();
      
           assertThat(MiniPlaceholders.getExpansionByName("example")).isNotNull();
       
      Parameters:
      name - the name of the required expansion
      Returns:
      the required expansion, if not present, will return null
      Since:
      2.1.0
      See Also: