package com.sakurarealm.playerrisk.hook;

import com.sakurarealm.playerrisk.api.PlayerRiskManager;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;

public class PlaceHolderAPIHook extends PlaceholderExpansion {

    private final PlayerRiskManager playerRiskManager;

    public PlaceHolderAPIHook(PlayerRiskManager playerRiskManager) {
        super();
        this.playerRiskManager = playerRiskManager;
    }

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

    @Override
    public String getAuthor() {
        return "sakurarealm";
    }

    @Override
    public String getVersion() {
        return "1.0";
    }

    @Override
    public String onRequest(OfflinePlayer player, String params) {
        if (params.equals("level")) { // prisk_level
            return String.valueOf(playerRiskManager.getPlayerRiskLevel(player));
        }
        return null;
    }
}
