forked from Upstream/mmocore
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.
|
* Resets information which much be reset after everything is saved.
|
||||||
*/
|
*/
|
||||||
player.mapSkillLevels().forEach((skill, level) -> player.resetSkillLevel(skill));
|
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.clearSkillTreePoints();
|
||||||
player.clearNodeLevels();
|
player.clearNodeLevels();
|
||||||
player.clearNodeStates();
|
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.
|
// Add the values to the times claimed table and claims the corresponding stat triggers.
|
||||||
nodeTimesClaimed.forEach((str, val) -> player.setClaims(str, val));
|
nodeTimesClaimed.forEach((str, val) -> player.setClaims(str, val));
|
||||||
|
|
||||||
|
|
||||||
// Unload current class information
|
// Unload current class information
|
||||||
player.unloadClassInfo(profess);
|
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 (guild != null) getData().setGuild(guild.hasMember(getData().getUniqueId()) ? guild : null);
|
||||||
}
|
}
|
||||||
if (!isEmpty(result.getString("attributes"))) getData().getAttributes().load(result.getString("attributes"));
|
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")))
|
if (!isEmpty(result.getString("professions")))
|
||||||
getData().getCollectionSkills().load(result.getString("professions"));
|
getData().getCollectionSkills().load(result.getString("professions"));
|
||||||
if (!isEmpty(result.getString("quests"))) getData().getQuestData().load(result.getString("quests"));
|
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"))
|
if (config.contains("attribute"))
|
||||||
data.getAttributes().load(config.getConfigurationSection("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"))
|
if (config.contains("profession"))
|
||||||
data.getCollectionSkills().load(config.getConfigurationSection("profession"));
|
data.getCollectionSkills().load(config.getConfigurationSection("profession"));
|
||||||
if (config.contains("quest"))
|
if (config.contains("quest"))
|
||||||
|
Loading…
Reference in New Issue
Block a user