Refactoring + adding a new skillranks config (not functional yet)

This commit is contained in:
nossr50
2019-01-12 23:54:53 -08:00
parent 0beabbf1ec
commit 6f77bb206d
117 changed files with 1149 additions and 855 deletions

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.child;
import java.util.EnumSet;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
@ -20,15 +20,15 @@ public class ChildConfig extends AutoUpdateConfigLoader {
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
for (PrimarySkill skill : PrimarySkill.CHILD_SKILLS) {
for (PrimarySkillType skill : PrimarySkillType.CHILD_SKILLS) {
plugin.debug("Finding parents of " + skill.name());
EnumSet<PrimarySkill> parentSkills = EnumSet.noneOf(PrimarySkill.class);
EnumSet<PrimarySkillType> parentSkills = EnumSet.noneOf(PrimarySkillType.class);
boolean useDefaults = false; // If we had an error we back out and use defaults
for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) {
try {
PrimarySkill parentSkill = PrimarySkill.valueOf(name.toUpperCase());
PrimarySkillType parentSkill = PrimarySkillType.valueOf(name.toUpperCase());
FamilyTree.enforceNotChildSkill(parentSkill);
parentSkills.add(parentSkill);
}
@ -46,12 +46,12 @@ public class ChildConfig extends AutoUpdateConfigLoader {
* If they're dedicated enough to have modified it, they can have the errors it may produce.
* Alternatively, this can be used to allow child skills to be parent skills, provided there are no circular dependencies this is an advanced sort of configuration.
*/
parentSkills.add(PrimarySkill.valueOf(name.toUpperCase()));
parentSkills.add(PrimarySkillType.valueOf(name.toUpperCase()));
}
}
// Register them
for (PrimarySkill parentSkill : parentSkills) {
for (PrimarySkillType parentSkill : parentSkills) {
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
FamilyTree.registerParent(skill, parentSkill);
}