Refactoring to make my life easier

This commit is contained in:
nossr50
2018-12-29 05:24:55 -08:00
parent 35368db05d
commit 0d260a74c9
126 changed files with 1471 additions and 1408 deletions

View File

@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.child;
import java.util.EnumSet;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.StringUtils;
public class ChildConfig extends AutoUpdateConfigLoader {
@ -20,15 +20,15 @@ public class ChildConfig extends AutoUpdateConfigLoader {
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
for (SkillType skill : SkillType.CHILD_SKILLS) {
for (PrimarySkill skill : PrimarySkill.CHILD_SKILLS) {
plugin.debug("Finding parents of " + skill.name());
EnumSet<SkillType> parentSkills = EnumSet.noneOf(SkillType.class);
EnumSet<PrimarySkill> parentSkills = EnumSet.noneOf(PrimarySkill.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 {
SkillType parentSkill = SkillType.valueOf(name.toUpperCase());
PrimarySkill parentSkill = PrimarySkill.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(SkillType.valueOf(name.toUpperCase()));
parentSkills.add(PrimarySkill.valueOf(name.toUpperCase()));
}
}
// Register them
for (SkillType parentSkill : parentSkills) {
for (PrimarySkill parentSkill : parentSkills) {
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
FamilyTree.registerParent(skill, parentSkill);
}