Class PlaceholderApiBridge

java.lang.Object
dev.crafty.core.bridge.placeholders.placeholderapi.PlaceholderApiBridge
All Implemented Interfaces:
Bridge, PlaceholderBridge

public class PlaceholderApiBridge extends Object implements PlaceholderBridge
Since:
1.0.4
  • Constructor Details

    • PlaceholderApiBridge

      public PlaceholderApiBridge()
  • Method Details

    • registerPlaceholder

      public void registerPlaceholder(String identifier, BiFunction<org.bukkit.entity.Player,String,String> replacer)
      Description copied from interface: PlaceholderBridge
      Registers a new placeholder with the given identifier and replacement function.
      Specified by:
      registerPlaceholder in interface PlaceholderBridge
      Parameters:
      identifier - the unique identifier for the placeholder (e.g., "player_name")
      replacer - a function that takes the input string and returns the replacement value
    • replacePlaceholders

      public String replacePlaceholders(String input)
      Description copied from interface: PlaceholderBridge
      Replaces all registered placeholders in the given input string with their corresponding values.
      Specified by:
      replacePlaceholders in interface PlaceholderBridge
      Parameters:
      input - the input string containing placeholders to be replaced
      Returns:
      the input string with all placeholders replaced
    • replacePlaceholders

      public String replacePlaceholders(String input, org.bukkit.entity.Player player)
      Description copied from interface: PlaceholderBridge
      Replaces all registered placeholders in the given input string with their corresponding values, using the provided Player context for player-specific placeholders.
      Specified by:
      replacePlaceholders in interface PlaceholderBridge
      Parameters:
      input - the input string containing placeholders to be replaced
      player - the player whose context should be used for placeholder replacement
      Returns:
      the input string with all placeholders replaced, using player context where applicable
    • getName

      public String getName()
      Description copied from interface: Bridge
      Returns the unique name of this bridge instance.
      Specified by:
      getName in interface Bridge
      Returns:
      the name of the bridge
    • canRegister

      public boolean canRegister()
      Description copied from interface: Bridge
      Checks if this bridge can be registered.
      Specified by:
      canRegister in interface Bridge
      Returns:
      true if the bridge can be registered, false otherwise