I need a plugin that randomly teleports players in a 1000x1000 radius when they die or when they first log in if you could help that would be amazing
I made a plugin just like this and is currently in the works of being submitted to poggit https://poggit.pmmp.io/ci/Trxgically/RandomSpawns/RandomSpawns This is the YouTube video on how to use it expect updates and stuff like that soon.
If you have any plugin ideas or suggestions or any help with my plugins my discord is N̶o̶T̶ ̶A̶ ̶B̶o̶B̶#5824
The code also teleports players inside of blocks, and we don’t want that, do we? Just save the xyz in a pos and do a safespawn instead of Floor+2
I know that is a bug I haven't gotten to yet and I don't know what you meant by "Just save the xyz in a pos and do a safespawn instead."
Something like this... PHP: $spawn = $level->getSafeSpawn();$coordX = rand($spawn->x + $firstX, $spawn->x + $secondX);$coordZ = rand($spawn->z + $firstZ, $spawn->z + $secondZ);$sender->teleport(new Position(rand(0,1) == 1 ? -$coordX : $coordZ, $this->getLowestBlock($level, round($coordX), round($coordZ)), rand(0, 1) == 1 ? -$coordZ : $coordZ, $level)); Function getLowestBlockAt() PHP: public function getLowestBlock(Level $level, $x, $z) : int{ if(!$level->isChunkLoaded((int)$x, (int)$z)){ return 128; } $chunk = $level->getChunk($x >> 4, $z >> 4); $x &= 0x0F; $z &= 0x0F; for($y = 0; $y < 128; $y++){ $block = $chunk->getBlockId($x, $y, $z); if($block !== 0) break; } if($y != 128){ return $y; } return 128; }