1.16.5 Worst bug in the history of spigot maybe ever

Discussion in 'Spigot Plugin Development' started by Gadse, Nov 6, 2020.

  1. EntityDeathEvent#getEntity returns LivingEntity :(
    • Funny Funny x 10
  2. You know that only living entities can die?
    • Funny Funny x 5
    • Agree Agree x 2
    • Winner Winner x 1
  3. Then why is isDead() in Entity instead of LivingEntity...

    • Winner Winner x 2
    • Like Like x 1
    • Funny Funny x 1
  4. Because you can counteract the death event, I'd consider the LivingEntity alive until all the event listeners have been called
  5. uh, no. the entity is already dead when the event is called? its more of a notification.
  6. Events are almost always triggered before performing the action to allow you to change/cancel something first.
  7. Not really since you can cancel the event, meaning death is handled after the event is triggered
  8. This is nonsense. You cannot cancel EntityDeathEvent (not PlayerDeathEvent for that matter). The entity has already been marked as dead, the event only allows you to change what should happen after the entity died. If you want to 'cancel' death, you should instead listen to EntityDamageEvent.
    So it indeed makes very little sense that this method returns a LivingEntity, as there is no way to revive the entity from this event. I think it would be much more sensical for it to return an Entity instead. You can try to report it as a bug maybe?
  9. I'm not 100% sure but I've read that you can stop the entity from dying by increasing its health.
  10. That might be possible indeed (never tested it). If it is a player, you can of course use Player#spigot().respawn(). But it still is the case that when the event is run (and all methods related to the event) the Entity is very much dead. I therefore agree with OP that it should return the more general Entity instead of LivingEntity, as there is no guarantee that the Entity is alive when you call its methods (most likely it is not).
  11. [​IMG]

    Docs, Cancellable
    • Funny Funny x 1
  12. Yeah just realized that this event isn’t cancellable lol