开发者文档

API

道具模块所对外暴露的所有API

    /**
     * 根据指定ID获取道具
     * @param propId 道具ID
     * @return 根据指定ID获取道具
     */
    IProp getById(String propId);

    /**
     * 获取所有道具
     * @return 获取所有道具
     */
    List<IProp> getAll();

    /**
     * 永久删除指定道具
     * 会删除配置文件中的道具信息
     * 慎用
     * @param prodId 道具ID
     */
    void deletePropById(String prodId);

    /**
     * 以指定玩家的身份来获取,获取指定的 1个 道具
     * @return 物品
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    ItemStack getItemStackById(Player p , String propId) throws ServiceErrorSendMsgException;

    /**
     * 保存指定道具 , 请确保该道具参数填写完整
     * @param IProp 道具对象
     * @return 保存成功或者失败
     */
    boolean saveProp(IProp IProp);


    /**
     * 校验玩家是否有指定数量的道具存在于背包中
     * @param player 玩家
     * @param propId 道具ID
     * @param count 数量
     * @return 校验玩家是否有指定数量的道具存在于背包中
     */
    boolean check(Player player, String propId, int count);

    /**
     * 删除玩家背包中指定数量的指定道具
     * @param player 玩家
     * @param propId 道具ID
     * @param count 数量
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    void removePlayerItem(Player player, String propId, int count) throws ServiceErrorSendMsgException;

    /**
     * 根据物品获取一个Prop对象
     * @param itemStack 物品
     * @return Prop对象
     */
    IProp getPropByItemStack(ItemStack itemStack);

    /**
     * 校验这个Prop是否能够正常使用
     * @param propId 道具ID
     * @return 校验这个Prop是否能够正常使用
     */
    boolean propIsPerfect(String propId);

    /**
     * 让这个玩家使用这个道具
     * @param uuid 玩家ID
     * @param propId 道具ID
     */
    void useProp(String uuid , String propId) throws ServiceErrorSendMsgException;

    /**
     * 获取这个用户这个道具最近一次的使用时间
     * @param uuid 用户ID
     * @param propId 道具ID
     * @return
     */
    long getUserPropRecentUseTime(String uuid , String propId);

    /**
     * 设置这个用户这个道具的最近一次的使用时间
     * @param uuid 用户ID
     * @param propId 道具ID
     * @param useTime 使用时间
     */
    void setUserPropRecentUseTime(String uuid , String propId , long useTime) throws ServiceErrorSendMsgException;

    /**
     * 校验玩家这个物品的前置装备条件是否满足
     * @param player 玩家
     * @param itemStack 物品
     * @return 校验玩家这个物品的前置装备条件是否满足
     */
    boolean itemUse(Player player , ItemStack itemStack);

    /**
     * 校验玩家当前主手物品能否使用
     * @param player 玩家
     * @return 校验玩家当前主手物品能否使用
     */
    boolean checkPlayerMainItem(Player player);

    /**
     * 校验玩家当前副手物品能否使用
     * @param player 玩家
     * @return 校验玩家当前副手物品能否使用
     */
    boolean checkPlayerOffItem(Player player);

事件

Last updated