Repository navigation
feat: optional invulnerable pets - #47
Merged
Merged
Conversation
care.invulnerable: true cancels every damage event on a pet at LOWEST, from players, mobs, projectiles and the environment alike, because a pet's death deletes it. The default false keeps the current behaviour, where only the pet's own owner is blocked from hurting it. Neglect deaths are unaffected: they set health directly and still follow care.death-on-neglect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A pet's death permanently deletes it. #45 stopped owners from hurting their own pets, but pets can still be killed by other players, mobs, projectiles and the environment (fall, fire, lava, void,
/kill...).Change
New option
care.invulnerable(defaultfalse):true:PetListener.onProtectedDamagecancels everyEntityDamageEventon a pet atLOWEST, whatever its cause or source.false: unchanged behaviour, only damage whose responsible player is the pet's owner is cancelled (fix: pets take no damage from their owner #45).The owner check and the new switch share one handler, which now listens to
EntityDamageEventinstead ofEntityDamageByEntityEvent. Because the event is cancelled early, the pet loses no mood and plays no hurt animation.Neglect deaths are unaffected: they set health directly and still follow
care.death-on-neglect.Config
Missing key =
false, so existing configs keep today's behaviour.Tests
care.invulnerable: true, stranger melee, a stranger's projectile, another mob, and fall/lava/fire/void/kill damage are all cancelled before other plugins see them, with no mood loss and no animation; non-pet entities are still damaged.false.PetListenerCoverageTest34/34 andNeedClockTest19/19 pass locally. The full local suite on Windows shows the usual environment-only failures (directory fsyncAccessDeniedException, cascading into "Already mocking"); CI on Linux is the authoritative run.🤖 Generated with Claude Code