예제 #1
0
 /**
  * Get the {@link org.bukkit.entity.LivingEntity} that a {@link com.dsh105.echopet.api.pet.Pet} is
  * targeting
  *
  * @param pet the attacker
  * @return {@link org.bukkit.entity.LivingEntity} being attacked, null if none
  */
 public LivingEntity getAttackTarget(IPet pet) {
   if (pet == null) {
     EchoPet.LOG.severe(
         "Failed to get attack target for Pet through the EchoPetAPI. Pet cannot be null.");
   }
   return pet.getCraftPet().getTarget();
 }
예제 #2
0
 /**
  * Set a target for the {@link com.dsh105.echopet.api.pet.Pet} to attack
  *
  * @param pet the attacker
  * @param target the {@link org.bukkit.entity.LivingEntity} for the {@link
  *     com.dsh105.echopet.api.pet.Pet} to attack
  */
 public void setAttackTarget(IPet pet, LivingEntity target) {
   if (pet == null) {
     EchoPet.LOG.severe(
         "Failed to set attack target for Pet through the EchoPetAPI. Pet cannot be null.");
     return;
   }
   if (target == null) {
     EchoPet.LOG.severe(
         "Failed to set attack target for Pet through the EchoPetAPI. Target cannot be null.");
     return;
   }
   if (pet.getEntityPet().getPetGoalSelector().getGoal("Attack") != null) {
     pet.getCraftPet().setTarget(target);
   }
 }