加点数据 (AttachHandle)

AttachHandle.class

类型

方法

描述

public boolean

increaseAttach(String key, int level, boolean admin)

增加某加点项的等级

public void

deductAttach(String key, int level)

降低某加点项的等级

public void

increasePoint(int point)

增加属性点

public void

deductPoint(int point)

扣除属性点

public int

getAttachLevel(String key)

得到某加点项等级

public int

getPoint()

得到剩余属性点数

public void

updateAttach()

更新加点属性(一般不用)

如何获取玩家身上的加点数据呢?

可通过 AttributeAPI 内的 getAttachData(Player player) 方法获取玩家身上的加点数据(AttachHandle)

AttachHandle attach = AttributeAPI.getAttachData(player);

如何为玩家增加某加点项而不消耗玩家属性点呢?

可通过 AttachHandle 内的 increaseAttach(String key, int level, boolean admin) 方法为指定加点项加点 String key — 加点项的Key为 attr/point 文件夹内的文件名,例如 attr/point/力量.yml 则 "力量" 就是这个加点项的 Key boolean admin — 是否为管理员操作 true 则直接为加点项增加等级,false 则会判断玩家是否拥有足够的属性点,如果满足则扣除属性点并增加加点项等级

AttachHandle attach = AttributeAPI.getAttachData(player);
attach.increaseAttach("力量", 5, true);

最后更新于

这有帮助吗?