Skip to content

开发文档

API

IYeeForgeAPI

kotlin
package me.yeezhi.yeeforge.api

import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import taboolib.library.configuration.ConfigurationSection

interface IYeeForgeAPI {

    /**
     * 获取锻造奖励物品
     * @param itemStack 物品
     * @param entryId 变量库
     * @return 处理后的物品
     */
    fun Player.getForgeItem(itemStack: ItemStack, entryId: String): ItemStack?

    /**
     * 获取锻造奖励物品
     * @param itemStack 物品
     * @param entryId 变量库
     * @param baseEntry 临时变量
     * @param extraEntry 额外变量
     * @return 处理后的物品
     */
    fun Player.getForgeItem(
        itemStack: ItemStack,
        entryId: String,
        baseEntry: MutableMap<String, String> = mutableMapOf(),
        extraEntry: Map<String, String> = emptyMap(),
    ): ItemStack?


    /**
     * 重铸锻造产物
     * @param itemStack 物品
     * @return 处理后的物品
     */
    fun Player.reforge(itemStack: ItemStack): ItemStack?
    /**
     * 获取锻造等级
     */
    fun Player.getForgeLevel(): Int

    /**
     * 添加锻造等级
     * @param level 等级
     */
    fun Player.addForgeLevel(level: Int): Int

    /**
     * 设置锻造等级
     * @param level 等级
     */
    fun Player.setForgeLevel(level: Int): Int

    /**
     * 获取玩家锻造经验
     */
    fun Player.getForgeExp(): Long

    /**
     * 添加锻造经验
     * @param exp 经验
     */
    fun Player.addForgeExp(exp: Long): Long

    /**
     * 获取升级所需经验
     * @param level 当前等级
     * @param expStage 经验配置
     */
    fun getUpgradeExp(level: Int, expStage: ConfigurationSection): Long

    /**
     * 获取升级所需经验
     */
    fun Player.getUpgradeExp(): Long

    /**
     * 玩家是否已学习该配方图纸
     * @param recipeName 配方名
     */
    fun Player.hasStudy(recipeName: String): Boolean

    /**
     * 学习配方
     * @param recipeName 配方名
     */
    fun Player.studyRecipe(recipeName: String)

    /**
     * 获取玩家当前保底统计
     * @param recipeName 配方名
     */
    fun Player.getGuarantee(recipeName: String): Int

    /**
     * 删除已学习的配方
     * @param recipeName 配方名
     */
    fun Player.removeRecipe(recipeName: String)

    /**
     * 获取配方合成统计次数
     * @param recipeName 配方名
     */
    fun Player.getCraftCount(recipeName: String): Int

    /**
     * 设置配方合成统计次数
     * @param recipeName 配方名
     * @param amount 次数
     */
    fun Player.addCraftCount(recipeName: String, amount: Int)

    /**
     * 设置配方合成统计次数
     * @param recipeName 配方名
     * @param amount 次数
     */
    fun Player.setCraftCount(recipeName: String, amount: Int)

    /**
     * 重置玩家保底统计
     * @param recipeName 配方名
     */
    fun Player.resetGuarantee(recipeName: String)

    /**
     * 添加玩家保底统计
     * @param recipeName 配方名
     * @param amount 数量
     */
    fun Player.addGuarantee(recipeName: String, amount: Int = 1)


}