Here I'm trying to call init(); function but I get this error I have used others way but I get the same error PHP: [15:46:18] [Server thread/CRITICAL]: Unhandled exception executing command 'admin' in admin: Undefined property: HenoriaCore\Core::$AdminForms[15:46:18] [Server thread/CRITICAL]: ErrorException: "Undefined property: HenoriaCore\Core::$AdminForms" (EXCEPTION) in "HenoriaCore-master/src/Commands/Admin/Admin" at line 33 Admin command function PHP: public function execute(CommandSender $sender, string $commandLabel, array $args):bool{ if(!$sender instanceof Player){ $sender->sendMessage(Core::USE_IN_GAME); } if(!$sender->hasPermission("Admin.command")){ $sender->sendMessage(Core::NO_PERM); } if($sender instanceof Player and $sender->hasPermission("admin.command")){ $this->core->AdminForms->init($sender);//The error is here } return true; } FormsAdmin function called PHP: public function init(Player $player){ $pk = new ModalFormRequestPacket(); $form = array(); $form["title"] = "AdminMenu"; $form["type"] = "form"; $form["content"] = ""; $form["buttons"][] = ["text" => "Ban"]; $form["buttons"][] = ["text" => "Kick"]; $pk->formId = 200; $pk->formData = json_encode($form); $player->dataPacket($pk); }
PHP: private $plugin, $player;public function __construct(MainFile $plugin, Player $player){$this->plugin = $plugin;$this->player = $player;self::init();}public static function init(){$pk = new ModalFormRequestPacket();$form = array();$form["title"] = "AdminMenu";$form["type"] = "form";$form["content"] = "";$form["buttons"][] = ["text" => "Ban"];$form["buttons"][] = ["text" => "Kick"];$pk->formId = 200;$pk->formData = json_encode($form);$player->dataPacket($pk);} Command: PHP: public function execute(CommandSender $sender, string $commandLabel, array $args):bool{ if(!$sender instanceof Player){ $sender->sendMessage(Core::USE_IN_GAME); } if(!$sender->hasPermission("Admin.command")){ $sender->sendMessage(Core::NO_PERM); } if($sender instanceof Player and $sender->hasPermission("admin.command")){ $this->adminforms = new AdminForms($this->core); } return true; }