Made it possible to unlock a skill that is not defined in the class.

This commit is contained in:
Ka0rX 2023-03-30 21:56:46 +01:00
parent 13b8b86b7b
commit d19da5f1cc

View File

@ -180,15 +180,13 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
+ id + "': " + exception.getMessage());
}
if (config.contains("skills"))
for (String key : config.getConfigurationSection("skills").getKeys(false))
try {
RegisteredSkill registered = MMOCore.plugin.skillManager.getSkillOrThrow(UtilityMethods.enumName(key));
skills.put(registered.getHandler().getId(), new ClassSkill(registered, config.getConfigurationSection("skills." + key)));
} catch (RuntimeException exception) {
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load skill info '" + key + "' from class '"
+ id + "': " + exception.getMessage());
}
for (RegisteredSkill registered : MMOCore.plugin.skillManager.getAll()) {
String key = registered.getHandler().getId();
if (config.contains("skills." + key))
skills.put(key, new ClassSkill(registered, config.getConfigurationSection("skills." + key)));
else
skills.put(key, new ClassSkill(registered, 1, 1));
}
castParticle = config.contains("cast-particle") ? new CastingParticle(config.getConfigurationSection("cast-particle")) : null;