mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Slightly changed player skills loading, hopefully removed NPEs
This commit is contained in:
parent
b4b437a2ce
commit
1ce01d7be0
@ -260,7 +260,11 @@ public class PlayerClass extends PostLoadObject {
|
||||
}
|
||||
|
||||
public boolean hasSkill(Skill skill) {
|
||||
return skills.containsKey(skill.getId());
|
||||
return hasSkill(skill.getId());
|
||||
}
|
||||
|
||||
public boolean hasSkill(String id) {
|
||||
return skills.containsKey(id);
|
||||
}
|
||||
|
||||
public SkillInfo getSkill(Skill skill) {
|
||||
|
@ -80,7 +80,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
|
||||
}
|
||||
if (!isEmpty(result.getString("bound_skills")))
|
||||
for (String skill : getJSONArray(result.getString("bound_skills")))
|
||||
if (MMOCore.plugin.skillManager.has(skill))
|
||||
if (data.getProfess().hasSkill(skill))
|
||||
data.getBoundSkills().add(data.getProfess().getSkill(skill));
|
||||
if (!isEmpty(result.getString("class_info"))) {
|
||||
JsonObject object = parser.fromJson(result.getString("class_info"), JsonObject.class);
|
||||
|
@ -53,7 +53,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
config.getConfigurationSection("skill").getKeys(false).forEach(id -> data.setSkillLevel(id, config.getInt("skill." + id)));
|
||||
if (config.contains("bound-skills"))
|
||||
for (String id : config.getStringList("bound-skills"))
|
||||
if (MMOCore.plugin.skillManager.has(id))
|
||||
if (data.getProfess().hasSkill(id))
|
||||
data.getBoundSkills().add(data.getProfess().getSkill(id));
|
||||
|
||||
/*
|
||||
@ -116,7 +116,8 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
config.set("class-info." + key + ".attribute-points", info.getAttributePoints());
|
||||
config.set("class-info." + key + ".attribute-realloc-points", info.getAttributeReallocationPoints());
|
||||
info.getSkillKeys().forEach(skill -> config.set("class-info." + key + ".skill." + skill, info.getSkillLevel(skill)));
|
||||
info.getAttributeKeys().forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute)));
|
||||
info.getAttributeKeys()
|
||||
.forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute)));
|
||||
}
|
||||
|
||||
file.save();
|
||||
|
Loading…
Reference in New Issue
Block a user