pocketmine\event\player\PlayerDeathEvent::getPlayer PHP Method

getPlayer() public method

public getPlayer ( ) : Player
return pocketmine\Player
    public function getPlayer()
    {
        return $this->entity;
    }

Usage Example

 public function onDeath(PlayerDeathEvent $e)
 {
     $p = $e->getPlayer();
     if ($p instanceof Player) {
         $cause = $p->getLastDamageCause();
         if ($cause instanceof EntityDamageByEntityEvent) {
             $light = new AddEntityPacket();
             $light->type = 93;
             $light->eid = Entity::$entityCount++;
             $light->metadata = array();
             $light->speedX = 0;
             $light->speedY = 0;
             $light->speedZ = 0;
             $light->x = $p->x;
             $light->y = $p->y;
             $light->z = $p->z;
             $p->dataPacket($light);
         }
     }
 }
All Usage Examples Of pocketmine\event\player\PlayerDeathEvent::getPlayer