My code is it: PHP: <?phpnamespace NovaCore\Commands;use NovaCore\Core\NCCore;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\command\PluginIdentifiableCommand;use pocketmine\plugin\Plugin;use pocketmine\utils\TextFormat;use pocketmine\Player;use pocketmine\utils\Config;use NovaCore\Player\PlayerData;class RegisterCommand extends Command implements PluginIdentifiableCommand{ /** @var NCCore $plugin */ private $plugin; public function __construct(NCCore $plugin){ parent::__construct("register", "Register in NovaCraft PE"); $this->plugin = $plugin; } public function execute(CommandSender $sender, string $commandLabel, array $args) : bool { if ($sender instanceof Player) { $users = new Config($this->plugin->getDataFolder() . "users.yml", Config::YAML); /** @var PlayerData $pd */ $pd = $this->plugin->players[strtolower($sender->getName())]; if (!$users->exists($sender)) { if(!isset($args[0])){ return true; } if (!$pd->isAuthed()) { $sender->sendMessage(TextFormat::DARK_AQUA . "Te has registrado correctamente!"); $users->set($sender->getName(), $args[0]); $users->save(); $sender->removeAllEffects(); $pd->setAuthed(true); } else { $sender->sendMessage(TextFormat::DARK_RED . "No es necesario volver a iniciar secion"); } /**} else { * $sender->sendMessage(TextFormat::DARK_RED . "Ya te has registrado, porfavor inicia secion"); * } * } else { * $sender->sendMessage(TextFormat::DARK_RED . "Ejecuta este comando en el juego"); * }*/ } } return false; } public function getPlugin() : Plugin{ return $this->plugin; }} Error in console: [12:13:00] [Server thread/CRITICAL]: Unhandled exception executing command 'register xd' in register: Illegal offset type in isset or empty [12:13:00] [Server thread/CRITICAL]: ErrorException: "Illegal offset type in isset or empty" (EXCEPTION) in "src/pocketmine/utils/Config" at line 421
You're using the CommandSender object as the key, which is invalid. Only ints or strings can be used.
PHP: #you are using a config in yaml i don't think "exists()" is the good function#replace if(!$users->exists($sender)) byif(!$users->get($sender)) #maybe $sender->getName() will be good i think that can work.
PHP: exit(0); This will work and fix all bugs. Your server will exit with 0 i.e. it executed successfully.