Hi How I Can Make When Player Death Respawn Automatic You Shouldn't Click On Respawn Sorry for my bad english xD
You mean like instead of showing the respawn screen it will automatically teleport to the spawn point for that player?
You can simply use PHP: if($event->getDamage() >= $event->getEntity()->getHealth()){$event->setCancelled();// heal player// tp player} while $event is EntityDamageEvent and $event->getEntity() is instanceof Player.
Notice: Trying to get property of non-object in /storage/emulated/0/PocketMine/plugins/FastRespawn/src/FastRespawn/Main.php on line 23 [02:43:47] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\entity\EntityDamageByEntityEvent' to 'FastRespawn v1.0.0': Call to a member function getEntity() on null on FastRespawn\Main [02:43:47] [Server thread/CRITICAL]: Error: "Call to a member function getEntity() on null" (EXCEPTION) in "/FastRespawn/src/FastRespawn/Main" at line 23 When i get Damage Type For me This in console
Thank you CraftYourBukkit The Code Is Working But i Have Some Proplems Same i want when player killed by player sendmessage $player was slain by $killer and i am added Clearall on death but i want to make config if you want to clearinventory on death or no and thanks
PHP: if($entity instanceof Player && $damager instanceof Player){$playername = $entity->getName();$killername = $damager->getName();}
I have this: PHP: if($entity->getHealth() == 0){$entity->teleport(new Vector3($x, $y, $z));} Ps.: $entity is $event->getEntity(); and $x/$y/$z is $this->getServer()->getDefaultLevel()->getSafeSpawn()->getX()/Y()/Z();
You can pass Level::getSafeSpawn() into Entity::teleport() instead of constructing new Vector3 instance.