Main.php PHP: $this->getServer()->getCommandMap()->register("enchantui", new ShopCommand($this)); ShopCommand.php PHP: public function __construct(Main $plugin) { parent::__construct($plugin, 'enchantui', 'Main Enchant command', ['eshop', 'es']); } i keep getting the following error: Code: TypeError: "Argument 1 passed to pocketmine\command\Command::__construct() must be of the type string, object given, called in /home/minecraft/plugins/EnchantUI/src/UnknownOre/ShopCommand.php on line 10" (EXCEPTION) in "src/pocketmine/command/Command" at line 81 i dont Know what's wrong
parent::__construct(); must be compatioble with parent class's __construct method PHP: /*** PluginCommand constructor.* @param string $name* @param Plugin $owner*/public function __construct(string $name, Plugin $owner); so you must add description using other functions PHP: public function __construct(Main $plugin) { parent::__construct('enchantui', $plugin); $this->setAliases(['eshop','es']); $this->setDescription('Main Enchant command'); }
i got this error after doing what you have said Code: TypeError: "Argument 2 passed to pocketmine\command\Command::__construct() must be of the type string, object given, called in /home/minecraft/plugins/EnchantUI/src/UnknownOre/ShopCommand.php on line 10" (EXCEPTION) in "src/pocketmine/command/Command" at line 81