Default Event Orverride

Discussion in 'Plugin Development' started by 7rmb7, Jun 26, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    7rmb7

    So when you die, certain things happen. Your items drop. Your body disappears. Et cetera.

    How would I override these things?
     
  2. Offline

    zonedabone

    EntityDeathEvent doesn't implement cancellable, so you can't cancel the death.

    You can, however, change the drops and such, and you can even detect respawn and make it as though the player did't die.
     
  3. Offline

    7rmb7

    How would I "change the drops and such"?
     
  4. Offline

    Weltall 7

    have a look at the APIdocs.
    examples:
    EntityDeathEvent: event.getDrops().clear() will remove all drops
    PlayerRespawnEvent: set respawn position to the player's current location to make the player spawn where he died.
     
  5. Offline

    zonedabone

    I tried changing respawn location, but doing it using respawn event didn't work all that well. Instead, look for PlayerMoveEvents and then check if that player just died, if so cancel the movement. (Thus bringing them back to their death spot)
     
  6. Offline

    Weltall 7

    Either the Bukkit team is to dumb/didn't implement it, or you have a plugin which sets the respawn position after yours, so your setting is overridden.
     
  7. Offline

    zonedabone

    Oh. Looking back I may be talking about the wrong thing. In the plugin I did this in, it was setting the players inventory, not changing respawn location.

    Carry on, now! :oops:
     
  8. Offline

    desmin88

    Or you can catch entitydamageevent and check if the damage is enough to kill the player.
     
Thread Status:
Not open for further replies.

Share This Page