Hi, My server is crashed !! At add title PHP: $api = Server::getInstance()->getPluginManager()->getPlugin("FormAPI"); if ($api === null || $api->isDisabled()) { return; } $form = $api->createSimpleForm(function (Player $sender, ?int $result = null) { if ($result === null) { return true; } switch ($result) { case 0: Server::getInstance()->dispatchCommand($sender, "help"); break; case 1: Server::getInstance()->dispatchCommand($sender, "help"); break; case 2: Server::getInstance()->dispatchCommand($sender, "help"); break; case 3: Server::getInstance()->dispatchCommand($sender, "help"); break; } return false; }); $form->setTitle("HI"); $form->setContent("HELOO"); $form->addButton("Button1"); $form->addButton("Button2"); $form->addButton("Button3"); $form->addButton("Button4"); $form->sendToPlayer($player); Plz help me
try using this alot of the code ur using is old i would try this heres the base PHP: <?phpdeclare(strict_types=1);namespaceuse pocketmine\event\Listener;use jojoe77777\FormAPI\SimpleForm;use pocketmine\plugin\PluginInBase;use pocketmine\plugin\PluginManager;use pokcetmine\utils\TextFormat as TFclass Main extends PluginInBase implements Listener { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this , $this); $this->getLogger()->info(TF::GREEN."FORM API TEST HAS BEEN ENABLED!"); } public function form(Player $player) { $form = new SimpleForm(function (Player $player, array $data = null) { if ($data === null) { return false; } switch ($data) { case 0: Server::getInstance()->dispatchCommand($player , "help"); break; } }); $form->setTitle("HI"); $form->setContent("HELOO"); $form->addButton("Button1"); $form->addButton("Button2"); $form->addButton("Button3"); $form->addButton("Button4"); $form->sendToPlayer($player); } }}
it also says that ur file ends at the wrong spot meaning u messed up on brackets either u left something out or it still needs a function placed as it says