mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Fixed attributes not reloading when switching profiles
This commit is contained in:
parent
7810e3695b
commit
dbe5aa5fab
@ -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);
|
||||
|
||||
|
@ -81,6 +81,8 @@ public class MMOCoreDataSynchronizer extends SQLDataSynchronizer<PlayerData> {
|
||||
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"));
|
||||
|
@ -64,6 +64,8 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler<PlayerDat
|
||||
}
|
||||
if (config.contains("attribute"))
|
||||
data.getAttributes().load(config.getConfigurationSection("attribute"));
|
||||
if (data.isOnline())
|
||||
MMOCore.plugin.attributeManager.getAll().forEach(attribute -> data.getAttributes().getInstance(attribute).updateStats());
|
||||
if (config.contains("profession"))
|
||||
data.getCollectionSkills().load(config.getConfigurationSection("profession"));
|
||||
if (config.contains("quest"))
|
||||
|
Loading…
Reference in New Issue
Block a user