Class PetTargetFilter

java.lang.Object
de.Keyle.MyPet.api.util.PetTargetFilter

public final class PetTargetFilter extends Object
The single answer to "may this pet target or damage that entity?".

Every AoE skill and targeting goal used to re-derive this from HookHelper primitives. Same-owner pets were skipped only because canHurt(owner, owner) happens to return false, which stops being a safe thing to lean on once a player can have several pets out.

  • Method Details

    • isSameOwnerPet

      public static boolean isSameOwnerPet(Pet pet, Entity candidate)
      True when candidate is a different pet belonging to pet's owner.
      Parameters:
      pet - the pet whose owner is compared; null yields false
      candidate - the entity to test; null yields false
      Returns:
      true if candidate is another pet of the same owner
    • canPetHurt

      public static boolean canPetHurt(Pet pet, Entity candidate)
      True when pet is allowed to damage or target candidate.

      Rejects the pet itself, its owner, the owner's other pets, the owner's tamed animals, and anything the region/PvP hooks protect.

      Parameters:
      pet - the attacking pet; null or an offline owner yields false
      candidate - the entity it would target or damage
      Returns:
      true if the pet may target or damage candidate