# Placeholder API

FancyCore includes a Placeholders API that allows you to create and manage custom placeholders for use in various plugins.

# Parse placeholders

To parse placeholders in a string, use the PlaceholderService's parse method. Here's an example:

PlaceholderService placeholderService = PlaceholderService.get();
String parsedString = placeholderService.parse(player, "Hello, {player_name}! Your rank is {player_rank}.");

# Creating a custom placeholder

To create a custom placeholder, implement the PlaceholderProvider interface and register it with the PlaceholderService. Here's an example of creating a simple placeholder that returns a player's rank:

public class PlayerRankPlaceholder implements PlaceholderProvider {

    @Override
    public String getName() {
        return "Player Rank Placeholder";
    }

    @Override
    public String getIdentifier() {
        return "player_rank";
    }

    @Override
    public String parse(FancyPlayer player, String input) {
        return player.getRank().getName();
    }
}

You can then register your placeholder provider with the PlaceholderService:

PlaceholderService placeholderService = PlaceholderService.get();
placeholderService.registerPlaceholderProvider(new PlayerRankPlaceholder());