Hi I want to know how you can get the thrower of a snowball in a ProjectileHitEvent? I would do something like put an array with that player's name to the entities ID but i cant seem to get the player in the ProjectileLaunchEvent or anything like that. Any Suggestions? Thanks.
Ok can you show me how to do this? I use an onDamage event rather than a death event. I do this: PHP: if(($pldp->getHealth() - $sd->getFinalDamage()) < 1 || $sd->getCause() === EntityDamageEvent::CAUSE_VOID){$sd->setCancelled();$pldp->setHealth(20); So i want to know how i can make it detect when someone is "pushed" into the void by someone throwing a snowball at them. Do you know how?
Here is some of the function to get the reason: PHP: if($pldp instanceof Player) {if ($sd instanceof EntityDamageByEntityEvent) {var_dump($sd->getDamager());if ($sd->getDamager() instanceof Player) {$deathMessage = "§8§l[§4SC§8] §6Sky§4Wars§8>§r§6 " . $pldp->getName() . " §4was killed by §6" . $sd->getDamager()->getName() . "§4!\n§6" . $this->P1 . " §4Players Remain!";LeaderBoardSystem::getInstance()->addOther($sd->getDamager()->getName(), "kills");}else {//TODO: Get tnt placer, shooter etc.$deathMessage = "§8§l[§4SC§8] §6Sky§4Wars§8>§r§6 " . $pldp->getName() . " §4has Died!\n§6" . $this->P1 . " §4Players Remain!";}} else {$deathMessage = "§8§l[§4SC§8] §6Sky§4Wars§8>§r§6 " . $pldp->getName() . " §4has Died!\n§6" . $this->P1 . " §4Players Remain!";}LeaderBoardSystem::getInstance()->addOther($pldp->getName(), "deaths");foreach ($this->players as $dpa) {$dpa->sendMessage($deathMessage);}}