Dead Message

Discussion in 'Spigot Plugin Help' started by Eptix, May 23, 2016.

  1. Hello,

    How can i do a dead message?

    i have a kill message: "name" was slain by "name".

    now i need a dead message: "name" died.

    how can i do that?
     
  2. Dude don't expect everyone to reply in 10 (!) minutes
     
    • Agree Agree x 1
    1. Make a PlayerDeathEvent listener.
    2. Get the killer ( e.getEntity().getKiller() )and the victim ( e.getEntity() ) (I recommend you save as variables)
    3. Check for null of the killer (Just in case the cause of death wasn't a player)
    4. Set the death message with #setDeathMessage(player1+" was killed by "+player2+"!");
    If killer is null then you can presume they died of some other cause, such as hostile mob or fall damage etc.

    Sorry if that wasn't very clear, I'm not amazing at explaining things.

    ~Dom