use of com.archyx.aureliumskills.stats.StatLeveler in project AureliumSkills by Archy-X.
the class StatReward method giveReward.
@Override
public void giveReward(Player player, Skill skill, int level) {
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData == null)
return;
playerData.addStatLevel(stat, value);
new StatLeveler(plugin).reloadStat(player, stat);
}
use of com.archyx.aureliumskills.stats.StatLeveler in project AureliumSkills by Archy-X.
the class StorageProvider method applyData.
protected void applyData(PlayerData playerData, Map<Skill, Integer> levels, Map<Skill, Double> xpLevels) {
for (Stat stat : plugin.getStatRegistry().getStats()) {
playerData.setStatLevel(stat, 0);
}
// Apply to object if in memory
for (Skill skill : Skills.values()) {
int level = levels.get(skill);
playerData.setSkillLevel(skill, level);
playerData.setSkillXp(skill, xpLevels.get(skill));
// Add stat levels
plugin.getRewardManager().getRewardTable(skill).applyStats(playerData, level);
}
// Reload stats
new StatLeveler(plugin).reloadStat(playerData.getPlayer(), Stats.HEALTH);
new StatLeveler(plugin).reloadStat(playerData.getPlayer(), Stats.LUCK);
new StatLeveler(plugin).reloadStat(playerData.getPlayer(), Stats.WISDOM);
// Immediately save to file
save(playerData.getPlayer(), false);
}
Aggregations