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


    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


    entityDeathEvent getLocation()

    That should get you started.
  3. Offline


    thank you Taco
  4. Offline


    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


    You need to use getEntity, not getPlayer
  6. Offline


    Ok, thanks. You should use

    Location location = event.getEntity.getLocation();

    if (event.getEntity istanceof Player)
  7. Offline


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

Share This Page