Hello Guys this code error and not work. what should i do? PHP: <?phpnamespace Legoboy\ST;use pocketmine\plugin\PluginBase;use pocketmine\utils\Config;class Loader extends PluginBase{ public static $db; public function onLoad(){ if(!file_exists($this->getDataFolder())){ @mkdir($this->getDataFolder()); } $this->saveDefaultConfig(); $mysql = self::$db = new \mysqli(!is_null($this->getConfig()->get("server-name")) ? $this->getConfig()->get("server-name") : "localhost", $this->getConfig()->get("username"), $this->getConfig()->get("password"), $this->getConfig()->get("simpleauth-dbname"), !is_null($this->getConfig()->get("port")) ? ((int)$this->getConfig()->get("port")) : 3306); if($mysql->connect_error){ die("Connection failed: " . $mysql->connect_error); $this->getServer()->getPluginManager()->disablePlugin($this); return; } $resource = $this->getResource("mysql.sql"); $mysql->query(stream_get_contents($resource)); fclose($resource); } public function onEnable(){ $this->process(); } public static function getMySQL(){ return self::$db; } public function process(){ $path = $this->getScheduler()->getPluginManager()->getPlugin("SimpleAuth")->getDataFolder() . "/players/"; $this->getScheduler()->scheduleAsyncTask(new QueryTask($path)); }} PHP: <?phpnamespace Legoboy\ST;use pocketmine\Server;use pocketmine\scheduler\AsyncTask;use Legoboy\ST\Loader as ST;class QueryTask extends AsyncTask{ private $path; const KEY_MYSQL = 'st.mysql'; const USERS = 0; public function __construct($path){ $this->path = $path; } public function onRun(){ foreach(glob($this->path . "*/*.yml") as $file){ $data = yaml_parse_file($file); var_dump($data); $player = strtolower(basename($file, ".yml")); $regdate = $data['registerdate']; $logindate = $data['logindate']; $ip = $data["lastip"]; $password = $data['hash']; $result = $this->getConnection()->query("INSERT INTO simpleauth_players (name, hash, registerdate, logindate, lastip) VALUES ('$pname', '$hash', '$regdate', '$logindate', '$ip')"); if($result){ self::USERS++; }else{ $this->getLogger()->critical("Unable to sumbit user to MySQL Database: Query error."); continue; } } } public function onCompletion(Server $server){ $base = $server->getPluginManager()->getPlugin("SimpleTransfer"); if($base instanceof PluginBase){ $base->getLogger()->warning("All users SUCCESSFULLY queried into database."); } } //PEMapModder's code /** * @return \mysqli */ public function getConnection(){ $mysql = $this->getFromThreadStore(sef::KEY_MYSQL); if(!($mysql instanceof \mysqli)){ $mysql = ST::getMySQL(); $this->saveToThreadStore(self::KEY_MYSQL, $mysql); } return $mysql; } public function saveToThreadStore($identifier, $value){ global $store; if(!$this->isGarbage()){ $store[$identifier] = $value; } } public function getFromThreadStore($identifier){ global $store; return $this->isGarbage() ? null : $store[$identifier]; }} and console send me this error: Code: [01:25:02] [Server thread/INFO]: Enabling SimpleTransfer v1.0.0 [01:25:02] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\scheduler\TaskScheduler::getPluginManager()" (EXCEPTION) in "plugins/DataTransfer-master/src/Legoboy/ST/Loader" at line 37 [01:25:02] [Server thread/DEBUG]: #0 plugins/DataTransfer-master/src/Legoboy/ST/Loader(29): Legoboy\ST\Loader->process() [01:25:02] [Server thread/DEBUG]: #1 src/pocketmine/plugin/PluginBase(123): Legoboy\ST\Loader->onEnable() [01:25:02] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(580): pocketmine\plugin\PluginBase->setEnabled(boolean 1) [01:25:02] [Server thread/DEBUG]: #3 src/pocketmine/Server(2002): pocketmine\plugin\PluginManager->enablePlugin(object Legoboy\ST\Loader) [01:25:02] [Server thread/DEBUG]: #4 src/pocketmine/Server(1988): pocketmine\Server->enablePlugin(object Legoboy\ST\Loader) [01:25:02] [Server thread/DEBUG]: #5 src/pocketmine/Server(1782): pocketmine\Server->enablePlugins(integer 1) [01:25:02] [Server thread/DEBUG]: #6 src/pocketmine/PocketMine(275): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[52] C:\Users\Administrator\Desktop\test server\LegendMc\, string[60] C:\Users\Administrator\Desktop\test server\LegendMc\plugins\) [01:25:02] [Server thread/DEBUG]: #7 src/pocketmine/PocketMine(299): pocketmine\server() [01:25:02] [Server thread/DEBUG]: #8 (1): require(string[107] phar://C:/Users/Administrator/Desktop/test server/LegendMc/PocketMine-MP.phar/sr) [01:25:02] [Server thread/INFO]: Disabling SimpleTransfer v1.0.0
getPluginManager() can only be called using a server instance. you are trying to use a task instance. error message says line 37 of Loader.php. Please read.
tnx for help but i dont know what i should do? can you say to me what should i do? wich code should with replace with another?
line 37 getPluginManager() is called from $this getPluginManager() cannot be called from $this call the function from the plugin base instead