Just wondering if theres a different event for falling out of the world other than just a deathevent, i looked at the api page and couldn't find it /: im wondering bc i want to try to attempt to make a plugin that will warp a player to lobby instantly when they fall in the void, i seem to have some corrupted region files causing a death loop when someone falls in the void ):
PHP: public function stopVoid(PlayerMoveEvent $ev){$p = $ev->getPlayer();if(intval($p->y) === 0){ $p->teleport($p->getLevel()->getSafeSpawn());}} it is better to do this if your lobby like a skyblock map: PHP: public function stopVoid(PlayerMoveEvent $ev){$p = $ev->getPlayer();if(intval($p->y) < 7){ $p->teleport($p->getLevel()->getSafeSpawn());}} just choose from the 2 snippets...
1. because i somehow prefer to use it than round(). i dont know which is better so ya ... 2. the first snippet was if the y coordinate of the player is equal to 0, it will teleport him back to spawn. it depends on the user of the code how he would manage it as they all work as intended.
Are you sure if you want to round or floor? That would do floor if you use intval. Anyway `(int) $num` is faster than `intval($num)`, whether $num is integer or floating point, or a string.