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

Called to an undefined method

Discussion in 'Plugin Help' started by WEATHERCRAFTYT1, Jan 31, 2021.

  1. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    Hello I’m making a plugin and everytime I run this command I get this error “Called to an undefined method Tb\Tb::isMapsOnline()”
    This line where it crashes
    PHP:
     }  else if ($args[0] === "join") {
      
    $this->isMapsOnline($player);    
    This Is the isMapsOnline method
    PHP:
    public function isMapsOnline(Player $player) : void {
               
    $config = new Config($this->getDataFolder()."/config.yml"Config::YAML);
            if(
    $config->get("arenas")!=null) {
                
    $maps $config->get("arenas",[]);
                 foreach(
    $maps as $online) {
                      
    $rule $config->get($online."Game");
                         if(
    $rule==Settings::PRE_TO_START_1) {
                           if(
    $this->isArenaUse($online)==true) continue;
                             
    $this->joinMH($pl,$online);
                             break;
                          } else {
                        
    $player->sendTip("§f[SK]§6 Finding you a match!");
                           }
                       }
                    } else {
                        
    $player->sendMessage("§c[ERROR]§6 Maps are full!");
                        }
               }
    Error line
    PHP:
    [16:21:10] [Server thread/CRITICAL]: Error"Call to undefined method Tb\Tb::isMapsOnline()" (EXCEPTIONin "plugins/Manhunt/src/Tb/traits/CommandsTrait" at line 100
    [16:21:10] [Server thread/CRITICAL]: #0 pmsrc/src/pocketmine/command/PluginCommand(54): Tb\Tb->onCommand(object pocketmine\Player, object pocketmine\command\PluginCommand, string[2] tb, array[1])
    [16:21:10] [Server thread/CRITICAL]: #1 pmsrc/src/pocketmine/command/SimpleCommandMap(248): pocketmine\command\PluginCommand->execute(object pocketmine\Player, string[2] tb, array[1])
    [16:21:10] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/Server(1810): pocketmine\command\SimpleCommandMap->dispatch(object pocketmine\Player, string[7] tb join)
    [16:21:10] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/Player(2322): pocketmine\Server->dispatchCommand(object pocketmine\Player, string[7] tb join)
    [16:21:10] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(239): pocketmine\Player->chat(string[8] /tb join)
    [16:21:10] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/network/mcpe/protocol/CommandRequestPacket(54): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleCommandRequest(object pocketmine\network\mcpe\protocol\CommandRequestPacket)
    [16:21:10] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(109): pocketmine\network\mcpe\protocol\CommandRequestPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter)
    [16:21:10] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/network/mcpe/protocol/BatchPacket(130): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\CommandRequestPacket)
    [16:21:10] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(109): pocketmine\network\mcpe\protocol\BatchPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter)
    [16:21:10] [Server thread/CRITICAL]: #9 pmsrc/src/pocketmine/Player(3273): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)
    [16:21:10] [Server thread/CRITICAL]: #10 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(169): pocketmine\Player->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)
    [16:21:10] [Server thread/CRITICAL]: #11 pmsrc/vendor/pocketmine/raklib/src/server/ServerHandler(95): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string[19] 65.34.223.109 64970, object raklib\protocol\EncapsulatedPacket, integer 0)
    [16:21:10] [Server thread/CRITICAL]: #12 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(109): raklib\server\ServerHandler->handlePacket()
    [16:21:10] [Server thread/CRITICAL]: #13 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(99): pocketmine\network\mcpe\RakLibInterface->process()
    [16:21:10] [Server thread/CRITICAL]: #14 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(113): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}()
    [16:21:10] [Server thread/CRITICAL]: #15 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(75): pocketmine\snooze\SleeperHandler->processNotifications()
    [16:21:10] [Server thread/CRITICAL]: #16 pmsrc/src/pocketmine/Server(2156): pocketmine\snooze\SleeperHandler->sleepUntil(double 1612110070.6662)
    [16:21:10] [Server thread/CRITICAL]: #17 pmsrc/src/pocketmine/Server(1993): pocketmine\Server->tickProcessor()
    [16:21:10] [Server thread/CRITICAL]: #18 pmsrc/src/pocketmine/Server(1587): pocketmine\Server->start()
    [16:21:10] [Server thread/CRITICAL]: #19 pmsrc/src/pocketmine/PocketMine(286): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[16] /home/container/, string[24] /home/container/plugins/)
    [16:21:10] [Server thread/CRITICAL]: #20 pmsrc/src/pocketmine/PocketMine(316): pocketmine\server()
    [16:21:10] [Server thread/CRITICAL]: #21 pmsrc(11): require(string[71] phar:///home/container/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
     
    Last edited: Jan 31, 2021
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Make sure they aren’t in a different file.
     
  3. iDarkQ

    iDarkQ Spider

    Messages:
    12
    GitHub:
    idarkq
    Is this function in the same class?
     
  4. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Baby Zombie

    Messages:
    121
    No, and I think that is the error but I’m not sure how to call the method
     
  5. iDarkQ

    iDarkQ Spider

    Messages:
    12
    GitHub:
    idarkq
    Yes that's it
     
  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.