[11:00:40] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 1" (EXCEPTION) in "plugins/KartAPI/src/leinne/plugin/kartapi/command/KartCommand" at line 34 Code: PHP: public function execute(CommandSender $sender, string $commandLabel, array $args) : void{ if(!$sender instanceof Player || !$this->testPermission($sender)){ return; } if(!isset($args[0])) { $sender->sendMessage("§r§l§b[Automotive Core]§r§f How to use: /$commandLabel <buy|sell>[<name>]"); return; } switch ($args[0]) { case "buy": $kart = KartAPI::getInstance()->getKart($args[1]); if($kart === null){ $sender->sendMessage("§r§l§b[Automotive Core]§r§f It doesn't exist.."); return; } KartAPI::getInstance()->buyKart($sender, $kart); break; case "sell": KartAPI::getInstance()->sellKart($sender); break; } }}
public function execute(CommandSender $sender, string $commandLabel, array $args) : void{ if(!$sender instanceof Player || !$this->testPermission($sender)){ return; } if(!isset($args[0])) { $sender->sendMessage("§r§l§b[Automotive Core]§r§f How to use: /$commandLabel <buy|sell>[<name>]"); return; } switch ($args[0]) { case "buy": if(!isset($args[1])){ $sender->sendMessage("/$commandLabel buy <name>"); return; } $kart = KartAPI::getInstance()->getKart($args[1]); if($kart === null){ $sender->sendMessage("§r§l§b[Automotive Core]§r§f It doesn't exist.."); return; } KartAPI::getInstance()->buyKart($sender, $kart); break; case "sell": KartAPI::getInstance()->sellKart($sender); break; } }