Package de.Keyle.MyPet.api.util
Class PetTargetFilter
java.lang.Object
de.Keyle.MyPet.api.util.PetTargetFilter
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 Summary
Modifier and TypeMethodDescriptionstatic booleancanPetHurt(Pet pet, Entity candidate) True whenpetis allowed to damage or targetcandidate.static booleanisSameOwnerPet(Pet pet, Entity candidate) True whencandidateis a different pet belonging topet's owner.
-
Method Details
-
isSameOwnerPet
True whencandidateis a different pet belonging topet's owner.- Parameters:
pet- the pet whose owner is compared;nullyieldsfalsecandidate- the entity to test;nullyieldsfalse- Returns:
trueifcandidateis another pet of the same owner
-
canPetHurt
True whenpetis allowed to damage or targetcandidate.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;nullor an offline owner yieldsfalsecandidate- the entity it would target or damage- Returns:
trueif the pet may target or damagecandidate
-