1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

plugin error with FormAPi dependency

Discussion in 'Development' started by Levi, Jun 6, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    error:
    Code:
    [17:51:53] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'FormAPI v1.1.1': Argument 2 passed to gay\API::gay\{closure}() must be of the type array, null given, called in C:\Users\arjxy\Desktop\New folder\plugins\FormAPI-master\src\jojoe77777\FormAPI\FormAPI.php on line 75 on jojoe77777\FormAPI\FormAPI
    [17:51:53] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to gay\API::gay\{closure}() must be of the type array, null given, called in C:\Users\arjxy\Desktop\New folder\plugins\FormAPI-master\src\jojoe77777\FormAPI\FormAPI.php on line 75" (EXCEPTION) in "core/src/gay/API" at line 20
    
    code
    PHP:
    class API
    {

        public static function 
    sendForm(Player $player)
        {
            
    $api $player->getServer()->getPluginManager()->getPlugin("FormAPI");
            
    $form $api->createSimpleForm(function (Player $player, array $data) {
                if (isset(
    $data[0])) {
                    
    $result $data[0];
                    switch (
    $result) {
                        case 
    0:
                            
    $player->sendMessage("1");
                            return;
                        case 
    1:
                            
    $player->sendMessage("2");
                            return;
                    }
                }
            });
            
    $form->setTitle("test");
            
    $form->setContent("testC");
            
    $form->addButton("test1");
            
    $form->sendToPlayer($player);
        }
    API::sendKitForm($commandSender);
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.