Search in sources :

Example 1 with StatLeveler

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);
}
Also used : StatLeveler(com.archyx.aureliumskills.stats.StatLeveler) PlayerData(com.archyx.aureliumskills.data.PlayerData)

Example 2 with StatLeveler

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);
}
Also used : Skill(com.archyx.aureliumskills.skills.Skill) Stat(com.archyx.aureliumskills.stats.Stat) StatLeveler(com.archyx.aureliumskills.stats.StatLeveler)

Aggregations

StatLeveler (com.archyx.aureliumskills.stats.StatLeveler)2 PlayerData (com.archyx.aureliumskills.data.PlayerData)1 Skill (com.archyx.aureliumskills.skills.Skill)1 Stat (com.archyx.aureliumskills.stats.Stat)1