Trying to get a killers uuid

Discussion in 'Plugin Development' started by 5scb8, Aug 17, 2014.

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

    5scb8

    Alright im doing a thing on witch the players killer gets 10 gems (also im useing my friends custom api for mysql connecting) now there seems to be a problem e.getEntity().getKiller().getUniqueId() is not returning the killers uuid so when i kill a player the player that was killed gets the gems not the killer (also this api works off of uuids)
     
  2. Offline

    fireblast709

    5scb8 paste the code. Your story is a bit contradicting.
     
  3. Offline

    SpaceManiac

    You get the Killer as a Player, get its UUID, then perform an impossible cast back to Player, then get its UUID again.
    Then, when sending the message, you send the player's killer's killer (which might not even be anyone) a message saying they killed the first killer who hasn't died yet. Try simplifying your code: You should really only need to call getKiller() once and getUniqueId() once.
     
  4. Offline

    fireblast709

    5scb8 you are casting an UUID to Player... Moreover, you don't check if getKiller() returns null (which happens when the Player died due to natural causes / mobs)
     
  5. Offline

    EnderTroll68

    What you want to do is
    Player killer = (Player) e.getEntity().getKiller();
    if(killer!=null) {
    UUID killers = killer.getUniqueId();
    }
     
  6. Offline

    5scb8

    Thank you it works now XD
     
Thread Status:
Not open for further replies.

Share This Page