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