Whats the code of location from a dead player

Discussion in 'Plugin Development' started by Einheitt11, Mar 7, 2012.

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

    Einheitt11

    How the title says "Whats the code of location from a dead player?"
    You need to know that im new to java. But yeah i searched the bukkit javadocs but cant find something for this. And does someone can show me how to spawn a mob at the dead location of a player.(I'll give credits to the one that helps me)
    Im developing a little plugin its name is On Death A Zombie Spawns, the name says all or??
    If someone could help me thank you.
    (I'm not to nooby to understand developing java, but i easily dont understand the new api very well..)
     
  2. Offline

    Taco

    entityDeathEvent getLocation()

    That should get you started.
     
  3. Offline

    Einheitt11

    thank you Taco
     
  4. Offline

    Iron_Crystal

    You need to make a listener for the event PlayerDeathEvent. Within the event, you get the player's location using Location location = event.getPlayer.getLocation();

    I am not in my eclipse, but I believe that's it.
     
  5. Offline

    kevhog

    You need to use getEntity, not getPlayer
     
  6. Offline

    Iron_Crystal

    Ok, thanks. You should use

    Location location = event.getEntity.getLocation();

    if (event.getEntity istanceof Player)
    {
    blahblahblah
    }
     
  7. Offline

    Jaker232

    To fix that:
    Code:java
    1.  
    2. Location location = event.getEntity().getLocation();
    3. if(event.getEntity() instanceof Player) {
    4. // Do something
    5. }
    6.  
     
Thread Status:
Not open for further replies.

Share This Page