use of de.Keyle.MyPet.api.skill.skills.LifeInfo in project MyPet by xXKeyleXx.
the class Life method upgrade.
public void upgrade(SkillInfo upgrade, boolean quiet) {
if (upgrade instanceof LifeInfo) {
if (upgrade.getProperties().getCompoundData().containsKey("hp")) {
int hp = upgrade.getProperties().getAs("hp", TagInt.class).getIntData();
upgrade.getProperties().getCompoundData().remove("hp");
TagDouble TagDouble = new TagDouble(hp);
upgrade.getProperties().getCompoundData().put("hp_double", TagDouble);
}
if (upgrade.getProperties().getCompoundData().containsKey("hp_double")) {
if (!upgrade.getProperties().getCompoundData().containsKey("addset_hp") || upgrade.getProperties().getAs("addset_hp", TagString.class).getStringData().equals("add")) {
hpIncrease += upgrade.getProperties().getAs("hp_double", TagDouble.class).getDoubleData();
} else {
hpIncrease = upgrade.getProperties().getAs("hp_double", TagDouble.class).getDoubleData();
}
if (getMyPet().getStatus() == PetState.Here) {
getMyPet().getEntity().get().setMaxHealth(getMyPet().getMaxHealth());
}
if (!quiet) {
myPet.getOwner().sendMessage(Util.formatText(Translation.getString("Message.Skill.Hp.Upgrade", myPet.getOwner().getLanguage()), myPet.getPetName(), myPet.getMaxHealth()));
}
}
}
}