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

Something is Error

Discussion in 'Help' started by NutXzG, Jan 26, 2020.

  1. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Hi, Find new error with FormAPI & Myplugin
    2020-01-26 [15:03:25] [Server thread/CRITICAL]: Error: "Call to a member function createSimpleForm() on null" (EXCEPTION) in "plugins/ตัวเสริม/src/SkyBlock/Loader/Loader" at line 47
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #0 plugins/ตัวเสริม/src/SkyBlock/Loader/Loader(26): SkyBlock\Loader\Loader->Form(object pocketmine\Player)
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #1 src/pocketmine/command/PluginCommand(58): SkyBlock\Loader\Loader->onCommand(object pocketmine\Player, object pocketmine\command\PluginCommand, string[4] sbui, array[0])
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #2 src/pocketmine/command/SimpleCommandMap(270): pocketmine\command\PluginCommand->execute(object pocketmine\Player, string[4] sbui, array[0])
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #3 src/pocketmine/Server(2065): pocketmine\command\SimpleCommandMap->dispatch(object pocketmine\Player, string[4] sbui)
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #4 src/pocketmine/Player(2373): pocketmine\Server->dispatchCommand(object pocketmine\Player, string[4] sbui)
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #5 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(245): pocketmine\Player->chat(string[5] /sbui)
    2020-01-26 [15:03:25] [Server thread/DEBUG]: #6 src/pocketmine/network/mcpe/protocol/CommandRequestPacket(54): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleCommandRequest(object pocketmine\network\mcpe\protocol\CommandRequestPacket)
    2020-01-26 [15:03:25] [Server threa
    PHP:
    <?php
    namespace SkyBlock\Loader;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\{
    CommandCommandSender
    };
    use 
    pocketmine\{
    PlayerServer
    };
    use 
    pocketmine\event\Listener;
    use 
    Skyblock\Loader\Commands\CommandTask;
    use 
    pocketmine\level\sound\{EndermanTeleportSound AnvilUseSoundAnvilBreakSoundClickSoundSoundFizzSoundPopSound};
     
     class 
    Loader extends PluginBase implements Listener {

        public function 
    onEnable() {
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getLogger()->info("SBUI เปิดทำงานแล้ว");
        }
       
        public function 
    onCommand(CommandSender $senderCommand $cmdstring $label, array $args) : bool {
            switch(
    $cmd->getName()){                  
                case 
    "sbui":
                    if (
    $sender instanceof Player){
                         
    $this->Form($sender);
                    }else{    
                         
    $sender->sendMesseage("§cคำสั่งนี้ใช้ในเกมส์เท่านั้น");
                         return 
    true;
                    }    
                break;        
               
             }
            return 
    true;                        
        }
       public function 
    checkDepends(): void{
            
    $this->formapi $this->getServer()->getPluginManager()->getPlugin("FormAPI");
            if(
    is_null($this->formapi)){
                
    $this->getLogger()->error("SBUI ต้องการ FromAPI ไม่ทำงาน!!");
                
    $this->getPluginLoader()->disablePlugin($this);
                
    $skyblockpl $this->getServer()->getPluginManger()->getPlugin("SkyBlock");
                if(
    is_null($skyblockpl)){$this->getLogger()->error(" SBUI ต้องการ Skyblock"); $this->getPluginLoader()->disablePlugin($this);}
            }
        }
        public function 
    Form(Player $p) {
        
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI");
            
    $form $api->createSimpleForm(function (Player $p$data){
                
    $result $data;
                if(
    $result === null){
                    return 
    true;
                }            
                switch(
    $result){
                    case 
    0:
                     
    $this->getServer()->dispatchCommand($p"is join");
                       
    $level->addSound(new EndermanTeleportSound($p));
                    break;
                       
                    case 
    1:
                       
    $this->getServer()->dispatchCommand($p"is create");
                 
    $level->addSound(new AnvilUseSound($p));
                    break;
            case 
    2:
            
    $this->DeleteIs($p);
            break;
            case 
    3:
            
    $this->Freind($p);
            break;
                 
                    case  
    4:
                 
    $p->addTitle("§ลาก่อนนะฮับ");
                 
    $p->addSubTitle("§aคราวหน้า&fมาใหม่");
                       break;
                }
               
               
                });
        
    $form->setTitle("§l§b | §6S§ck§ay§bb§dl§5o§ec§2k §b|");
          
    $form->setContent("§l§aกด§dที่§bปุ่ม§eเพื่อ§6ใช้§cฟันชั่ง");
           
    $form->addButton("§l§6| §aเข้า§eเกาะ §6| \n §f§oกดเพื่อเข้าเกาะ");
           
    $form->addButton(" §l§a | §f§bสร้าง§dเกาะ §a|  \n§f§oกดเพื่อสร้างเกาะ");
           
    $form->addButton(" §l§d | §cลบ§4เกาะ §d| \n§f§oกดเพื่อลบเกาะ!");
           
    $form->addButton(" §l§4| §eเมนู§cเพื่อน §4|\n§f§oกดเพื่อเมนูเกาะ!");
            
    $form->addButton(" §l§2 | §cออก §2| \n§f§oกดเพื่ออก!");
    $form->sendToPlayer($p);                                                        
          }
           public function 
    DeleteIs(Player $p){
            
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI");
            
    $form $api->createModalForm(function (Player $p$data){
                
    $result $data;
                if (
    $result == null) {
                }
                switch (
    $result) {
                        case 
    1:
          
    $this->getServer()->dispatchCommand($p"is disband");    
           
    $p->getLevel()->addSound(new AnvilBreakSound($p));
                            break;
                            case 
    2:
           
    $p->getLevel()->addSound(new ClickSound($p));
                            break;
                }
            });
           
    $form->setTitle(" §cลบเกาะ!");
           
    $form->setContent("คุณแน่ใจหรอที่ต้องการลบเกาะ ถ้าใช่ กด  §l§aใช่ ถ้าไม่กด §l§cไม่ใช้");
           
    $form->setButton1("§l§d §aใช่ §d|");
           
    $form->setButton2("§l§a | §cใช่ §a|");
           
    $form->sendToPlayer($p);
           return 
    $form;
           }
           public function 
    Freind(Player $p){
           
    $form $this->getServer()->getPluginManager()->getPlugin("FormAPI")->createSimpleForm(Function (Player $p$data){
           
    $result $data;
           if(
    $result === null){
           return 
    true;
                 }
                  switch(
    $result){
                  case 
    0:
                  
    $this->InviteFreind($p);
                       
    $p->getLevel()->addSound(new PopSound($p));
                  break;
                  case 
    1:
                  
    $invite "is acc";
                  
    $this->getServer()->dispatchCommand($p$invite);
                  
    $p->getLevel()->addSound(new AnvilUseSound($p));
                  break;
                  case 
    2:
                  
    $invite "is d";
                  
    $this->getServer()->dispatchCommand($p$invite);
           
    $p->getLevel()->addSound(new AnvilBreakSound($p));
                  break;
                  }
                  });
                   
    $form->setTitle("§l§b | §6S§ck§ay§bb§dl§5o§ec§2k §b|");
                       
    $form->setContent("§l§aกด§dที่§bปุ่ม§eเพื่อ§6ใช้§cฟันชั่ง");
                       
    $form->addButton("§l§e | §aเชิญ§bคน§dเข้า§4เกาะ\n§f§oกดเพื่อเชิญคน");
                       
    $form->addButton(" §l§2 | §aตอบรับคำเชิญ §2| \n§f§oกดเพื่อรับคำเชิญ");
                       
    $form->addButton("§l§6 | §4ปฎิเสธคำเชิญ §6 | \n§f§oกดเพื่อปฎิเสธ");
                       
    $form->sendToPlayer($p);
           }
           public function 
    InviteFreind(Player $p){
           
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI");
                           
    $form $api->createCustomForm(function (Player $p$data){  
                               
    $input $data[0];
                    if(
    $input === null){
                        return 
    true;
                        }
                    If(!
    $input === null){
                    
    $p->sendMessage("§4ได้โปรดใส่ชื่อ");
                                }
                    
    $this->getServer()->dispatchCommand($p"is invite $input");
            
    $p->getLevel()->addSound(new ClickSound($p));
      });
                                           
    $form->setTitle("§l§b | §6S§ck§ay§bb§dl§5o§ec§2k §b|");
                                         
                                           
    $form->addInput("พิมชื่อตรงนี่: ""Steve");              
                                           
    $form->sendToPlayer($p);
                                           }
    }
    Code:
    name: SbUI
    version: 1.0
    main: SkyBlock\Loader\Loader
    api: [3.0.0]
    author: Nutzatvch
    
    commands:
      sbui:
        description:  "เปิดหน้าต่าง"
    Thanks you
     
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    You've not added FormAPI to your server.
     
    HimbeersaftLP likes this.
  3. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
  4. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    It's not enabled according to the error's sayings.
     
  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.