Class PlaceholderService

java.lang.Object
com.github.darksoulq.abyssallib.server.translation.PlaceholderService

public final class PlaceholderService extends Object
Provides integration between the translation system and PlaceholderAPI (PAPI).

This service allows the use of PAPI placeholders within MiniMessage tags via the <papi:placeholder_name> syntax.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    apply(@Nullable org.bukkit.entity.Player player, @NotNull String text)
    Applies PlaceholderAPI parsing to a raw string.
    static net.kyori.adventure.text.minimessage.tag.resolver.TagResolver
    resolve(@Nullable org.bukkit.entity.Player player)
    Creates a TagResolver that handles the papi tag.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlaceholderService

      public PlaceholderService()
  • Method Details

    • resolve

      public static net.kyori.adventure.text.minimessage.tag.resolver.TagResolver resolve(@Nullable @Nullable org.bukkit.entity.Player player)
      Creates a TagResolver that handles the papi tag.

      Usage in MiniMessage: <papi:player_name>

      Parameters:
      player - The Player context for placeholder parsing.
      Returns:
      A TagResolver if PAPI is enabled and player is non-null, otherwise an empty resolver.
    • apply

      public static String apply(@Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull String text)
      Applies PlaceholderAPI parsing to a raw string.
      Parameters:
      player - The Player context.
      text - The raw text containing %placeholder% markers.
      Returns:
      The parsed string, or the original text if PAPI is unavailable.