1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Player death world

Discussion in 'Development' started by Hipster, Dec 28, 2016.

  1. Hipster

    Hipster Zombie

    Messages:
    214
    How to get the player's world where he got killed?
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I think something like this would work:
    PHP:
    public function onDeath(PlayerDeathEvent $event) {
         
    $worldname $event->getEntity()->getLevel()->getName();
    }
     
    Dog2puppy likes this.
  3. Hipster

    Hipster Zombie

    Messages:
    214
    But won't this code give the location of where he respawned?
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I donno, try it :p xD
     
  5. Dog2puppy

    Dog2puppy Slime

    Messages:
    94
    GitHub:
    colesquared
    No, because PlayerDeathEvent fires on death and not respawn.
     
    HimbeersaftLP likes this.
  6. Ad5001

    Ad5001 Silverfish

    Messages:
    16
    GitHub:
    ad5001
    I will give one name: PlayerRespawnEvent
     
    HimbeersaftLP and Dog2puppy like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.