use of com.laytonsmith.abstraction.enums.MCPotionType in project CommandHelper by EngineHub.
the class ObjectGenerator method potionData.
public MCPotionData potionData(CArray pd, Target t) {
MCPotionType type = MCPotionType.valueOf(pd.get("type", t).val().toUpperCase());
boolean extended = false;
boolean upgraded = false;
if (pd.containsKey("extended")) {
Construct cext = pd.get("extended", t);
if (cext instanceof CBoolean) {
extended = ((CBoolean) cext).getBoolean();
} else {
throw new CREFormatException("Expected potion value for key \"extended\" to be a boolean", t);
}
}
if (pd.containsKey("upgraded")) {
Construct cupg = pd.get("upgraded", t);
if (cupg instanceof CBoolean) {
upgraded = ((CBoolean) cupg).getBoolean();
} else {
throw new CREFormatException("Expected potion value for key \"upgraded\" to be a boolean", t);
}
}
try {
return StaticLayer.GetPotionData(type, extended, upgraded);
} catch (IllegalArgumentException ex) {
throw new CREFormatException(ex.getMessage(), t, ex);
}
}
Aggregations