How to set the snowball thrower as killer

Discussion in 'Spigot Plugin Development' started by TheGamerPlayz, May 31, 2016.

Thread Status:
Not open for further replies.
  1. I am making a plugin that causes snowballs to do 1 heart of damage, but how would I make it say the killer in a death message? I am using the EntityDamageByEntityEvent
  2. Use player death event and set death message to what ever message you like
  3. I guess, but i was wondering if there was a way without making another listener
    Edit: also this still can't get who threw the snowball anyways
  4. What's wrong with using a listener? Super effective for this task.
  5. We posted at the same time look at my edit
  6. get a shooter of the projectile?
  7. I can get the shooter, but I can't seem to make the shooter the killer, I would've thought player.damage would've worked, but it does nothing
  8. well, that's how it's designed. the ball itself is the killer and you get the thrower through get shooter if you need to use thrower's information in your plugin.
  9. I believe in order to get the cause of death, simply use .getkiller and check if its an instance of a snowball.
  10. What do you mean by make the shooter the killer?
  11. I mean so they when the snowball gets a kill, It says that they killed the player
  12. then you need to just get shooter from projectile and display that message.
    or bit more hacky way would be to cancel the event and create another EntityDamageByEntity event and set the shooter of the snowball as the killer.
  13. set the death message as (e.getentity.getname + "was killed by a snowball").
  14. I mean that it will display who threw the snowball so like Gold killed vk2 with a snowball
  15. For clarification, what does event.getkiller return? Does it return the actual snowball or a player?
  16. Ok a better way to phrase this is to ask who threw the snowball that killed him and i now realize how pointless this thread is so closing
Thread Status:
Not open for further replies.