1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

ProjectileHitEvent

Discussion in 'Bugs & Feature Requests' started by R3XET, Nov 25, 2019.

?

Do you think ProjectileHitEvent should be cancellable?

  1. Yes, because... (Explain in comments)

  2. No, because... (Explain in comments)

Results are only viewable after voting.
  1. Hi SpigotMC's users, before before commenting or voting please read this: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileHitEvent.html!
    I think that add a cancellable option to ProjectileHitEvent will help devs in their plugin. Let's make an example.
    I'm adding a cooldown to my DamageSnowball plugin, but it's more difficulty to do because I can't use two events in a void, like ProjectileHitEvent and
    EntityDamageByEntityEvent, so when a player throws the snowball the only thing you can do is to refund the snowball, but it's still launched, so if your plugin do stuff when it hit an entity you can't cancel it.
     
  2. You should suggest it in JIRA.
     
  3. You mean cancel the snowball while it's still on traveling ?
     
  4. Before, to prevent being throweb, like PlayerInteractEvent with items like egg
     
  5. Phoenix616

    Resource Staff

    While I agree that this event could potentially be made to support cancelling I don't agree with your argumentation for doing so: It should be possible to simply cancel the EntityDamageByEntityEvent when you detect that the damaging entity is the projectile to achieve what you want, the ProjectileHitEvent being cancellable would just lead to the same effect without an added benefit. (well at most that the entity wouldn't have an arrow stick out of them I guess but that can be modified manually too)

    Also I'm unsure how that event is actually implemented and if cancelling is easily possible at that place as it seems to be part of the movement method (haven't looked too much into it) so I have my doubts if anyone will spend lots of time implementing something that can be achieved in a different way already if it really isn't easily possible.