DeathEvent & Respawn Event

Discussion in 'Plugin Development' started by badboysteee98, Apr 15, 2014.

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

    badboysteee98

    So I want to make a plugin where if someone dies it tells them who kills them what is the best way for this as DeathEvent won't let me do e.getPlayer() and so on.

    But if they died because they fell or /suicide don't tell them anything

    If I haven't said enough tell me so I can add more thanks :D
     
  2. Offline

    BillyGalbreath

    Code:java
    1.  
    2. @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
    3. public void deathEvent(PlayerDeathEvent event) {
    4. Player deadPlayer = event.getEntity();
    5. }
    6.  
     
  3. Offline

    badboysteee98

  4. Offline

    BillyGalbreath

    Code:java
    1.  
    2. @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
    3. public void deathEvent(PlayerDeathEvent event) {
    4. Player killed = event.getEntity();
    5. Player killer = killed.getKiller();
    6. }
    7.  
     
  5. Offline

    badboysteee98

    BillyGalbreath Thanks alot :D

    I get this message

    You was killed by CraftPlayer{name=kylesminecraft2}

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. Offline

    BillyGalbreath

    Because you are using the Player object. To get their name you must "get" their name like killer.getName();
     
    badboysteee98 likes this.
  7. Offline

    badboysteee98

    BillyGalbreath Wow how stupid am I sorry for wasting your time my bad :)
     
Thread Status:
Not open for further replies.

Share This Page