Skip to content

Conversation

@yoyosource
Copy link

Add a way to check what Entity got pushed by an Explosion happening. This event is only called for non LivingEntities because there is the EntityKnockbackEvent for that already. I am using this on a server where I am a Developer already for cancelling specific Explosions knocking around other Entities.

@yoyosource yoyosource requested a review from a team as a code owner October 29, 2025 09:21
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Oct 29, 2025
Copy link
Contributor

@lynxplay lynxplay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have EntityKnockbackEvent and EntityKnockbackByAttackEvent which both are fine with plain entities.

The event you are proposing is pretty much a 1 to 1 copy of EntityPushedByEntityAttackEvent.
I think the solution here is to call the previously mentioned events.
Change org.bukkit.craftbukkit.event.CraftEventFactory#callEntityKnockbackEvent to take in an CraftEntity instead of CraftLivingEntity and then call the correct legacy and paper events if the entity is living vs not.

@github-project-automation github-project-automation bot moved this from Awaiting review to Changes required in Paper PR Queue Nov 1, 2025
Update CraftEventFactory.callEntityKnockbackEvent
@yoyosource yoyosource requested a review from lynxplay November 7, 2025 09:34
@Huge-mistake
Copy link

Huge-mistake commented Nov 26, 2025

Yo, is this PR ready? Seems like it could fix the issue. @lynxplay
#13326

@yoyosource
Copy link
Author

I have tested it and locally it works. I am just waiting on a second review from somebody or the first reviewer.

@Huge-mistake
Copy link

Huge-mistake commented Nov 26, 2025

https://github.com/yoyosource/Paper/blob/feature/EntityPushByExplodeEvent/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java#L2074

May trigger NPE and requires a minor modification.
event.setCancelled(legacyEvent != null && legacyEvent.isCancelled());

@yoyosource
Copy link
Author

Good catch. I will fix it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

3 participants