I have this code: PHP: public function onCommand(CommandSender $player, Command $command, $label, array $args) : bool{ switch ($command->getName()) { case "sg": if($player->isOp()) { if(!empty($args[0])) { if($args[0]=="make") { if(!empty($args[1])) { if(file_exists($this->getServer()->getDataPath() . "/worlds/" . $args[1])) { $this->getServer()->loadLevel($args[1]); $this->getServer()->getLevelByName($args[1])->loadChunk($this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorX(), $this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorZ()); array_push($this->arenas,$args[1]); $this->currentLevel = $args[1]; $this->mode = 1; $player->sendMessage("§eYou are now in §6SETUP MODE§r§e. Tap a block to set the first spawn point."); $player->setGamemode(1); $player->teleport($this->getServer()->getLevelByName($args[1])->getSafeSpawn(),0,0); } else { $player->sendMessage("§c[ERROR] §7Couldn't find a world with this name"); } } else { $player->sendMessage(TextFormat::YELLOW . "/sg make <world> §7make an sg arena"); } } } else { $player->sendMessage(TextFormat::YELLOW . "/sg make <world> §7make an sg arena"); $player->sendMessage(TextFormat::YELLOW . "/sg join <world> §7join an sg game"); } } break; case "join": if($player->isOp()) { if(!empty($args[0])) { if(!empty($args[1])) { if(file_exists($this->getServer()->getDataPath() . "/worlds/" . $args[1])) { $this->getServer()->loadLevel($args[1]); $this->getServer()->getLevelByName($args[1])->loadChunk($this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorX(), $this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorZ()); array_push($this->arenas,$args[1]); $this->currentLevel = $args[1]; $this->mode = 1; $level = $this->getServer()->getLevelByName($this->currentLevel); $levelArena = $level; $playersArena = $levelArena->getPlayers(); $gamecount = count($this->getServer()->getLevelByName($this->currentLevel)->getPlayers()); $this->currentLevel = $level; $player->setFood(20); $player->setHealth(20); $player->setGamemode(0); $level = $this->currentLevel; $x = -963; $y = 33; $z = 837; $pos = new Vector3($x,$y,$z); $player->teleport($level->getSafeSpawn($pos)); $levelArena = $level; $playersArena = $levelArena->getPlayers(); $gamecount = count($this->getServer()->getLevelByName($args[1])->getPlayers()); foreach($playersArena as $pl) $pl->sendMessage(TextFormat::YELLOW . $player->getNameTag() . TextFormat::YELLOW . " joined the game. (" . TextFormat::AQUA . $gamecount . TextFormat::RESET . TextFormat::AQUA . "/24" . TextFormat::YELLOW . ")"); } } } else { $player->sendMessage(TextFormat::YELLOW . "/sg join <world> §7Join and sg game"); } } } return true; } The first command works perfectly fine (/sg make) but the second command (/sg join) does not work. why is this. btw the second command is not finished, there are still more things I must add but as it is now it's not working and not showing any errors when the command in ran
you somehow attempted to create /make and not /sg make here's it fixed: PHP: <?phppublic function onCommand(CommandSender $player, Command $command, $label, array $args): bool{ switch($command->getName()){ case "sg": if(!empty($args[0])){ switch($args[0]){ case "make": if($player->isOp()){ if(!empty($args[1])){ if(file_exists($this->getServer()->getDataPath() . "/worlds/" . $args[1])){ $this->getServer()->loadLevel($args[1]); $this->getServer()->getLevelByName($args[1])->loadChunk($this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorX(), $this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorZ()); array_push($this->arenas, $args[1]); $this->currentLevel = $args[1]; $this->mode = 1; $player->sendMessage("§eYou are now in §6SETUP MODE§r§e. Tap a block to set the first spawn point."); $player->setGamemode(1); $player->teleport($this->getServer()->getLevelByName($args[1])->getSafeSpawn(), 0, 0); }else{ $player->sendMessage("§c[ERROR] §7Couldn't find a world with this name"); } }else{ $player->sendMessage(TextFormat::YELLOW . "/sg make <world> §7make an sg arena"); } } break; case "join": if($player->isOp()){ if(!empty($args[0])){ if(!empty($args[1])){ if(file_exists($this->getServer()->getDataPath() . "/worlds/" . $args[1])){ $this->getServer()->loadLevel($args[1]); $this->getServer()->getLevelByName($args[1])->loadChunk($this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorX(), $this->getServer()->getLevelByName($args[1])->getSafeSpawn()->getFloorZ()); array_push($this->arenas,$args[1]); $this->currentLevel = $args[1]; $this->mode = 1; $level = $this->getServer()->getLevelByName($this->currentLevel); $levelArena = $level; $playersArena = $levelArena->getPlayers(); $gamecount = count($this->getServer()->getLevelByName($this->currentLevel)->getPlayers()); $this->currentLevel = $level; $player->setFood(20); $player->setHealth(20); $player->setGamemode(0); $level = $this->currentLevel; $x = -963; $y = 33; $z = 837; $pos = new Vector3($x,$y,$z); $player->teleport($level->getSafeSpawn($pos)); $levelArena = $level; $playersArena = $levelArena->getPlayers(); $gamecount = count($this->getServer()->getLevelByName($args[1])->getPlayers()); foreach($playersArena as $pl) $pl->sendMessage(TextFormat::YELLOW . $player->getNameTag() . TextFormat::YELLOW . " joined the game. (" . TextFormat::AQUA . $gamecount . TextFormat::RESET . TextFormat::AQUA . "/24" . TextFormat::YELLOW . ")"); } } }else{ $player->sendMessage(TextFormat::YELLOW . "/sg join <world> §7Join and sg game"); } } } }else{ $player->sendMessage(TextFormat::YELLOW . "/sg make <world> §7make an sg arena"); $player->sendMessage(TextFormat::YELLOW . "/sg join <world> §7join an sg game"); } break; } return true;}