Skip to content

VehicleDamageEvent: Get Lightning Attacker #13571

@CatTeaA

Description

@CatTeaA

Is your feature request related to a problem?

Animals or mobs may be riding the vehicle. When lightning—either summoned by a player's trident or generated naturally by weather—strikes a creature on the vehicle, the vehicle will be damaged/destroyed by the lightning, yet VehicleDamageEvent.getAttacker() will return null in such cases.
When a vehicle is damaged by cacti or lava, VehicleDamageEvent.getAttacker() also returns null.(Do not want to fully cancel the VehicleDamageEvent)

Area protection plugins expect VehicleDamageEvent.getAttacker() to retrieve the lightning entity that damages the vehicle, and subsequently obtain the player who summoned the lightning via LightningStrike for more granular protection checks.

Describe the solution you'd like.

VehicleDamageEvent.getAttacker() can retrieve the lightning entity.

Describe alternatives you've considered.

When the EntityZapEvent is cancelled, the struck entity will be immune to lightning damage.

This method seems better: when any entity is struck by lightning and the event is cancelled, the damage event can be cancelled as well.

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions