Interface PlaceholderBridge

All Superinterfaces:
Bridge
All Known Implementing Classes:
PlaceholderApiBridge

public interface PlaceholderBridge extends Bridge
The PlaceholderBridge interface defines the contract for integrating placeholder functionality within the application. Implementations of this interface allow for the registration and replacement of placeholders in strings, typically used for dynamic content rendering.

This bridge is intended to be used with external placeholder plugins or systems. It extends the Bridge interface and provides methods for registering custom placeholders and replacing them in input strings.

Since:
1.0.4
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Returns the name of this bridge implementation.
    void
    registerPlaceholder(String identifier, BiFunction<org.bukkit.entity.Player,String,String> replacer)
    Registers a new placeholder with the given identifier and replacement function.
    Replaces all registered placeholders in the given input string with their corresponding values.
    replacePlaceholders(String input, org.bukkit.entity.Player player)
    Replaces all registered placeholders in the given input string with their corresponding values, using the provided Player context for player-specific placeholders.

    Methods inherited from interface dev.crafty.core.bridge.Bridge

    canRegister, getName, pluginEnabled
  • Method Details

    • registerPlaceholder

      void registerPlaceholder(String identifier, BiFunction<org.bukkit.entity.Player,String,String> replacer)
      Registers a new placeholder with the given identifier and replacement function.
      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

      String replacePlaceholders(String input)
      Replaces all registered placeholders in the given input string with their corresponding values.
      Parameters:
      input - the input string containing placeholders to be replaced
      Returns:
      the input string with all placeholders replaced
    • replacePlaceholders

      String replacePlaceholders(String input, org.bukkit.entity.Player player)
      Replaces all registered placeholders in the given input string with their corresponding values, using the provided Player context for player-specific placeholders.
      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
    • bridgeName

      default String bridgeName()
      Returns the name of this bridge implementation.
      Specified by:
      bridgeName in interface Bridge
      Returns:
      the string "Placeholder"