Get the item shot from a dispenser that killed a player

Discussion in 'Plugin Development' started by triarry, Feb 11, 2013.

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


    Hi there, I'm attempting to get the item that is shot from a dispenser, and then in turn kills a player. If this item doesn't kill a player, I don't want anything to happen. If it does, I want something to happen

    Rather than set up an arbitrary number of items (potions, arrows) that can kill a player, I want to account for other blocks that, in certain scenarios, might be able to kill players, such as snowballs.

    Thanks in advance!
  2. Offline


    How would snowballs ever kill someone? They don't do damage. Some plugins apply damage when a snowball hits, but that doesn't make the snowball the source of the damage.

    You'll probably just have to use EntityDamageEvent and set up your "arbitrary number of items"
  3. Offline


    Interesting, I assumed that there was a better way to handle items coming out of a dispenser. Will give this a shot and report. Thanks!
  4. Offline


    Try EntityDamageByEntityEvent, check if the entity is a snowball (or whatever) and snowball.getShooter() instanceof Dispenser I believe.
    microgeek likes this.
Thread Status:
Not open for further replies.

Share This Page