Clear child skill FamilyTree on reload

This commit is contained in:
riking 2013-09-27 15:46:19 -07:00
parent 1ca53da0e2
commit fa34d06341
2 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,8 @@ public class ChildConfig extends AutoUpdateConfigLoader {
protected void loadKeys() { protected void loadKeys() {
config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource("child.yml"))); config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource("child.yml")));
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
for (SkillType skill : SkillType.childSkills()) { for (SkillType skill : SkillType.childSkills()) {
plugin.debug("Finding parents of " + skill.name()); plugin.debug("Finding parents of " + skill.name());

View File

@ -35,6 +35,10 @@ public class FamilyTree {
} }
} }
protected static void clearRegistrations() {
tree.clear();
}
protected static void enforceChildSkill(SkillType skill) { protected static void enforceChildSkill(SkillType skill) {
if (!skill.isChildSkill()) { if (!skill.isChildSkill()) {
throw new IllegalArgumentException(skill.name() + " is not a child skill!"); throw new IllegalArgumentException(skill.name() + " is not a child skill!");