setPermission(DefaultPermissionNames::COMMAND_SETWORLDSPAWN); } public function execute(CommandSender $sender, string $commandLabel, array $args){ if(!$this->testPermission($sender)){ return true; } if(count($args) === 0){ if($sender instanceof Player){ $location = $sender->getPosition(); $world = $location->getWorld(); $pos = $location->asVector3()->floor(); }else{ $sender->sendMessage(TextFormat::RED . "You can only perform this command as a player"); return true; } }elseif(count($args) === 3){ $world = $sender->getServer()->getWorldManager()->getDefaultWorld(); $pos = new Vector3($this->getInteger($sender, $args[0]), $this->getInteger($sender, $args[1]), $this->getInteger($sender, $args[2])); }else{ throw new InvalidCommandSyntaxException(); } $world->setSpawnLocation($pos); Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_setworldspawn_success((string) $pos->x, (string) $pos->y, (string) $pos->z)); return true; } }