PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Ways to get cause for EntityCombustEvent

Open alvin0319 opened this issue 2 years ago • 1 comments

Description

Add a new EntityIgniteEvent called when an entity is being ignited by something, e.g by the player or TNT.

Justification

With the current API, there is no way to know who/which player/thing caused the entity to be ignited.

The following class added: EntityIgniteEvent

EntityIgniteEvent->getCause() : ?Entity: Returns an entity that caused this entity to be ignited.

Thing to consider

Make this event Cancellable:

  • After this event, events such as EntityExplodeEvent/ExplosionPrimeEvent will be called anyway, so I don't think this event need to be cancellable, instead, we could just cancel exploding in EntityExplodeEvent/ExplosionPrimeEvent

Alternative methods

N/A

alvin0319 avatar Apr 06 '23 04:04 alvin0319

After this event, events such as EntityExplodeEvent/ExplosionPrimeEvent will be called anyway, so I don't think this event need to be cancellable

This depends on the behaviour of the entity when ignited.

We could also use EntityCombustEvent for the same purpose.

dktapps avatar Apr 07 '23 20:04 dktapps