53 $target = $this->fetchPermittedPlayerTarget($commandLabel, $sender, $args[0] ??
null, DefaultPermissionNames::COMMAND_SPAWNPOINT_SELF, DefaultPermissionNames::COMMAND_SPAWNPOINT_OTHER);
58 if(count($args) === 4){
59 $world = $target->getWorld();
60 $pos = $sender instanceof
Player ? $sender->getPosition() : $world->getSpawnLocation();
61 $x = $this->getRelativeDouble($pos->x, $sender, $args[1]);
62 $y = $this->getRelativeDouble($pos->y, $sender, $args[2], World::Y_MIN, World::Y_MAX);
63 $z = $this->getRelativeDouble($pos->z, $sender, $args[3]);
64 $target->setSpawn(
new Position($x, $y, $z, $world));
66 Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_spawnpoint_success($target->getName(), (
string) round($x, 2), (
string) round($y, 2), (
string) round($z, 2)));
69 }elseif(count($args) <= 1 && $sender instanceof
Player){
70 $cpos = $sender->getPosition();
71 $pos = Position::fromObject($cpos->floor(), $cpos->getWorld());
72 $target->setSpawn($pos);
74 Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_spawnpoint_success($target->getName(), (
string) round($pos->x, 2), (
string) round($pos->y, 2), (
string) round($pos->z, 2)));