Apply fix to API, AbstractMethodError

This commit is contained in:
Jack Lin 2015-01-18 22:49:26 +13:00
parent db0c691892
commit de0b638a82

View file

@ -207,6 +207,7 @@ public class AbilityModuleManager {
}
}
for (AbilityModule ab: ability) {
try {
//To check if EarthBlast == Earthblast or for example, EarthBlast == EARTHBLAST
boolean succes = true;
for(String enabledAbility : abilities){
@ -275,6 +276,20 @@ public class AbilityModuleManager {
// if (ab.isMetalbendingAbility()) metalbendingabilities.add(ab.getName());
descriptions.put(ab.getName(), ab.getDescription());
authors.put(ab.getName(), ab.getAuthor());
} catch (AbstractMethodError e) { //If triggered means ability was made pre 1.6 BETA 8
ProjectKorra.log.warning("The ability " + ab.getName() + " is either broken or outdated. Please remove it!");
e.printStackTrace();
ab.stop();
abilities.remove(ab.getName());
final AbilityModule skill = ab;
//Bellow to avoid ConcurrentModificationException
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
ability.remove(skill);
}
}, 10);
continue;
}
}
Collections.sort(airbendingabilities);