Skip to content

refactor: simplify hitbox damage trigger checks#282

Merged
toxicity188 merged 1 commit intov2-devfrom
codex/refactor-hitboxlistener-and-related-apis
Feb 17, 2026
Merged

refactor: simplify hitbox damage trigger checks#282
toxicity188 merged 1 commit intov2-devfrom
codex/refactor-hitboxlistener-and-related-apis

Conversation

@toxicity188
Copy link
Owner

Motivation

  • Remove a redundant cancellation check because triggered() already encapsulates the cancellation state for hitbox damage events to make the damage gate simpler and less error-prone.

Description

  • Replaced if (!event.call().triggered() || event.cancelled) with if (!event.call().triggered()) across NMS and Fabric hitbox damage paths to centralize cancellation semantics.
  • Files updated: nms/v1_21_R1/.../HitBoxImpl.kt, nms/v1_21_R3/.../HitBoxImpl.kt, nms/v1_21_R4/.../HitBoxImpl.kt, nms/v1_21_R5/.../HitBoxImpl.kt, nms/v1_21_R6/.../HitBoxImpl.kt, nms/v1_21_R7/.../HitBoxImpl.kt, and platform/fabric/.../HitBoxEntityImpl.kt.
  • No API signatures were changed and behavior is intended to remain equivalent given current ModelDamagedEvent.call().triggered() semantics.
  • Commit created: 5429d46d.

Testing

  • Ran repository searches with rg to verify there are no remaining event.cancelled checks in the affected hitbox damage paths and confirmed all replaced occurrences now use if (!event.call().triggered()); this check succeeded.
  • Verified the modified lines by inspecting surrounding code snippets to ensure listener.damage(event) is invoked before the triggered() check; no automated compile or unit tests were run in this change.

Codex Task

@toxicity188 toxicity188 merged commit f79886d into v2-dev Feb 17, 2026
1 check passed
@toxicity188 toxicity188 deleted the codex/refactor-hitboxlistener-and-related-apis branch February 21, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant