public void schedule() { if (increaseHpBy > 0 && myPet.getStatus() == PetState.Here) { if (timeCounter-- <= 0) { if (myPet.getHealth() < myPet.getMaxHealth()) { addPotionGraphicalEffect(myPet.getCraftPet(), 0x00FF00, 40); // Green Potion Effect myPet .getCraftPet() .getHandle() .heal((float) increaseHpBy, EntityRegainHealthEvent.RegainReason.REGEN); } timeCounter = regenTime; } } }
private static InactiveMyPet getInactiveMyPet(MyPet activeMyPet) { InactiveMyPet inactiveMyPet = new InactiveMyPet(activeMyPet.getOwner()); inactiveMyPet.setPetName(activeMyPet.petName); inactiveMyPet.setExp(activeMyPet.getExperience().getExp()); inactiveMyPet.setHealth(activeMyPet.getHealth()); inactiveMyPet.setHungerValue(activeMyPet.getHungerValue()); inactiveMyPet.setLocation(activeMyPet.getLocation()); inactiveMyPet.setRespawnTime(activeMyPet.respawnTime); inactiveMyPet.setSkills(activeMyPet.getSkills().getSkills()); inactiveMyPet.setInfo(activeMyPet.getExtendedInfo()); inactiveMyPet.setPetType(activeMyPet.getPetType()); inactiveMyPet.setSkillTree(activeMyPet.getSkillTree()); return inactiveMyPet; }