try
{
Class abilityClass = AbilityHandler.stringToClassMap.get(ability);
if(abilityClass != null)
{
Ability ab = ((Ability)abilityClass.getConstructor().newInstance());
try
{
ab.parse(argVars.toArray(new String[0]));
}
catch(Exception e2)
{
Morph.console("Mappings are erroring! These mappings are probably invalid or outdated: " + abilityClass.getName() + ", "+ ability + ", args: " + args, true);
}
abilityObjs.add(ab);
}
else
{
Morph.console("Ability \"" + ability + "\" does not exist for: " + e.getKey() + ", args: " + args, true);
}
}
catch(Exception e2)
{
e2.printStackTrace();
}
}
if(!ability.isEmpty() && !hasArgs)
{
Class abilityClass = AbilityHandler.stringToClassMap.get(ability);
if(abilityClass != null)
{
try
{
abilityObjs.add((Ability)abilityClass.getConstructor().newInstance());
}
catch(Exception e2)
{
e2.printStackTrace();
}
}
else
{
Morph.console("Ability \"" + ability + "\" does not exist for: " + e.getKey(), true);
}
}
}
}
if(abilityObjs.size() > 0){
Class<? extends EntityLivingBase> entityClass = (Class<? extends EntityLivingBase>) Class.forName(e.getKey());
if(entityClass != null){
if(AbilityHandler.abilityMap.containsKey(entityClass))
{
Morph.console("Ignoring ability mapping for " + e.getKey() + "! Already has abilities mapped!", true);
}
else
{
if(entityClass.getName().startsWith("net.minecraft"))
{
mcMappings++;
}
else
{
StringBuilder sb = new StringBuilder();
sb.append("Adding ability mappings ");
for(int i = 0; i < abilityObjs.size(); i++)
{
Ability a = abilityObjs.get(i);
sb.append(a.getType());
if(i != abilityObjs.size() - 1)
{
sb.append(", ");
}
}