diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java index 5a07f44c..47e2cfe6 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java @@ -305,7 +305,8 @@ public class SavedClassInformation implements ClassDataContainer { * Resets information which much be reset after everything is saved. */ player.mapSkillLevels().forEach((skill, level) -> player.resetSkillLevel(skill)); - player.getAttributes().getInstances().forEach(ins -> ins.setBase(0)); + for (PlayerAttribute attribute : MMOCore.plugin.attributeManager.getAll()) + player.getAttributes().getInstance(attribute).setBase(0); player.clearSkillTreePoints(); player.clearNodeLevels(); player.clearNodeStates(); @@ -346,7 +347,6 @@ public class SavedClassInformation implements ClassDataContainer { // Add the values to the times claimed table and claims the corresponding stat triggers. nodeTimesClaimed.forEach((str, val) -> player.setClaims(str, val)); - // Unload current class information player.unloadClassInfo(profess); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/sql/MMOCoreDataSynchronizer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/sql/MMOCoreDataSynchronizer.java index 2ce01a59..99d2f774 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/sql/MMOCoreDataSynchronizer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/sql/MMOCoreDataSynchronizer.java @@ -81,6 +81,8 @@ public class MMOCoreDataSynchronizer extends SQLDataSynchronizer { if (guild != null) getData().setGuild(guild.hasMember(getData().getUniqueId()) ? guild : null); } if (!isEmpty(result.getString("attributes"))) getData().getAttributes().load(result.getString("attributes")); + if (getData().isOnline()) + MMOCore.plugin.attributeManager.getAll().forEach(attribute -> getData().getAttributes().getInstance(attribute).updateStats()); if (!isEmpty(result.getString("professions"))) getData().getCollectionSkills().load(result.getString("professions")); if (!isEmpty(result.getString("quests"))) getData().getQuestData().load(result.getString("quests")); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java index 9542a275..fd1e2a74 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java @@ -64,6 +64,8 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler data.getAttributes().getInstance(attribute).updateStats()); if (config.contains("profession")) data.getCollectionSkills().load(config.getConfigurationSection("profession")); if (config.contains("quest"))