[12:11:50] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Server::getScheduler()" (EXCEPTION) in "plugins/napthe.phar/src/BeanGTA/TCore/UIS/vtui" at line 38 [12:11:50] [Server thread/DEBUG]: #0 plugins/FromAPI.phar/src/jojoe77777/FormAPI/FormAPI(84): BeanGTA\TCore\UIS\vtui->BeanGTA\TCore\UIS\{closure}(pocketmine\Player object, array Array()) [12:11:50] [Server thread/DEBUG]: #1 src/pocketmine/plugin/MethodEventExecutor(38): jojoe77777\FormAPI\FormAPI->onPacketReceived(pocketmine\event\server\DataPacketReceiveEvent object) [12:11:50] [Server thread/DEBUG]: #2 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(jojoe77777\FormAPI\FormAPI object, pocketmine\event\server\DataPacketReceiveEvent object) [12:11:50] [Server thread/DEBUG]: #3 src/pocketmine/event/Event(99): pocketmine\plugin\RegisteredListener->callEvent(pocketmine\event\server\DataPacketReceiveEvent object) [12:11:50] [Server thread/DEBUG]: #4 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(107): pocketmine\event\Event->call() [12:11:50] [Server thread/DEBUG]: #5 src/pocketmine/network/mcpe/protocol/BatchPacket(119): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\ModalFormResponsePacket object) [12:11:50] [Server thread/DEBUG]: #6 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(108): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object) [12:11:50] [Server thread/DEBUG]: #7 src/pocketmine/Player(3111): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) [12:11:50] [Server thread/DEBUG]: #8 src/pocketmine/network/mcpe/RakLibInterface(170): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) [12:11:50] [Server thread/DEBUG]: #9 vendor/pocketmine/raklib/src/server/ServerHandler(99): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 192.168.1.43 48135, raklib\protocol\EncapsulatedPacket object, integer 0) [12:11:50] [Server thread/DEBUG]: #10 src/pocketmine/network/mcpe/RakLibInterface(110): raklib\server\ServerHandler->handlePacket() [12:11:50] [Server thread/DEBUG]: #11 src/pocketmine/network/mcpe/RakLibInterface(100): pocketmine\network\mcpe\RakLibInterface->process() [12:11:50] [Server thread/DEBUG]: #12 vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}() [12:11:50] [Server thread/DEBUG]: #13 vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications() [12:11:50] [Server thread/DEBUG]: #14 src/pocketmine/Server(2345): pocketmine\snooze\SleeperHandler->sleepUntil(double 1551096710.6963) [12:11:50] [Server thread/DEBUG]: #15 src/pocketmine/Server(2205): pocketmine\Server->tickProcessor() [12:11:50] [Server thread/DEBUG]: #16 src/pocketmine/Server(1784): pocketmine\Server->start() [12:11:50] [Server thread/DEBUG]: #17 src/pocketmine/PocketMine(250): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string /home/bean/M..n h..nh n...n/PocketMine/, string /home/bean/M..n h..nh n...n/PocketMine/plugins/) [12:11:50] [Server thread/DEBUG]: #18 (1): require(string phar:///home/bean/M..n h..nh n...n/PocketMine/PocketMine-MP.phar/src/pocketmine/PocketMine.php) [12:11:50] [Server thread/INFO]: BeanGTA rời trò chơi [12:11:50] [Server thread/INFO]: BeanGTA[/192.168.1.43:48135] logged out due to Internal server error [12:11:50] [RakLibServer thread/NOTICE]: Blocked 192.168.1.43 for 5 seconds [12:12:06] [Server thread/INFO]: [•=(MrFace)=•] Mua VIP nhận đặc quyền nhận tiền hoa hồng
But Plugins My here <?php namespace BeanGTA\TCore\UIS; use pocketmine\Player; use pocketmine\command\ConsoleCommandSender; use pocketmine\utils\TextFormat; use BeanGTA\TCore\Tasks\NapTheTask; use BeanGTA\TCore\Main; class vtui{ private $plugin; public function __construct(Main $plugin){ $this->plugin = $plugin; } public function init(Player $sender){ $api = $this->plugin->getServer()->getPluginManager()->getPlugin("FormAPI"); $form = $api->createCustomForm(function (Player $sender, array $data){ $result = $data[0]; if($result != null){ $mang = "VIETTEL"; $ten = "Viettel"; $data = [ "merchant" => '3582', "apiemail" => '[email protected]', "securecode" => '22d4a8e255b77de7f75b1c01e1819312', "mang" => $mang, "ten" => $ten, "seri" => $data[0], "sopin" => $data[1], ]; $this->plugin->getServer()->getScheduler()->scheduleAsyncTask(new NapTheTask($data, $sender)); } }); $form->setTitle("Viettel"); $form->addInput("Nhập Số Seri:"); $form->addInput("Nhập Mã Pin:"); $form->addLabel("Mệnh Giá:"); $form->addLabel("10.000 = 10 coin"); $form->addLabel("20.000 = 20 coin"); $form->addLabel("50.000 = 50 coin"); $form->addLabel("100.000 = 100 coin"); $form->sendToPlayer($sender); } }
getScheduler is a function of the PluginBase class and not of the Server class, that's why it doesn't work. It used to be that way in the old API, but that has changed since this commit (or this PR). BUT WAIT AsncTasks are not handled by that Scheduler anymore, instead, the AsyncPool is used for that, to get the AsyncPool, you can use Server->getAsyncPool. Then you can use AsyncPool->submitTask to start your AsyncTask. The fixed code would look like this: PHP: $this->plugin->getServer()->getAsyncPool()->submitTask(new NapTheTask($data, $sender)); Also, in the future please use the PHP tag like this: [PHP]Put code here[/PHP] to insert code.