Good night of the PMMP forum, my mistake is this: I do not know if it is an error since my plugin runs without any error in pocketmine localhost, but when I send the same to a dedicated server the plugin starts everything correctly but when I try execute some command, it gives an error ... I'm sorry for my bad English, I'm Brazilian. My error is as follows: (2) .phar / src / WNCORE / Plugins / Homes / Homes.php on. line 21 17.11 20:10:56 [Server] Server thread / CRITICAL Unhandled exception executing command 'homes' in homes: Call to a member function query () on null 17.11 20:10:56 [Server] Server thread / CRITICAL Error: "Call to a member function query () on null" (EXCEPTION) in "/ WhinterCore PL (2) .phar / src / WNCORE / Plugins / Homes / Homes "at line 21 My code is this: <?php namespace WNCORE\Plugins\Homes; use pocketmine\command\{Command, CommandSender}; use pocketmine\Player; use pocketmine\plugin\PluginBase; use pocketmine\Server; use pocketmine\level\Level; use pocketmine\level\Position; use WNCORE\Loader; class Homes extends Command{ public function __construct(Loader $plugin){ $this->pl = $plugin; parent::__construct('homes', 'Veja a lista de homes'); } public function execute(CommandSender $sender, $label, array $args){ $player = strtolower($sender->getName()); $sql = $this->pl->db->query("SELECT * FROM homes WHERE player = '$player';"); $result = $sql->fetchArray(SQLITE3_ASSOC); if($result['player'] == NULL){ $sender->sendMessage("§7[§9!§7] Você não possui nenhuma home!"); return true; } $sender->sendMessage("§7[§9!§7] Lista de homes §7[§9!§7]"); while($home = $sql->fetchArray(SQLITE3_ASSOC)){ $sender->sendMessage("§8- §e{$home['home']}"); } } } From what I understand, the error is in the part of: public function __construct(Loader $plugin){ $this->pl = $plugin; parent::__construct('homes', 'Veja a lista de homes'); } that the plugin can not call the $this->pl function that is calling the class Main (Loader.php)
Loader is: public function onEnable(){ $this->db = new \SQLite3($this->getDataFolder()."homes.sqlite3"); } Is database!
File is not found or invalid. So or so, the db becomes or stays null, so the database connection is not found. Is sqlite enabled in php.ini?
The sqlite is enabled yes, in pocketmine everything works normal but when it is in hosting it sends the error shown ... From what I know it should be in $this->pl because when I tried calling a config function it gave the same thing. ..
in Main : public function getDataBase(){ @mkdir($this->getDataFolder()); $this->db = new \SQLite3($this->getDataFolder()."homes.sqlite3"); return $this->db; } In Homes : $db = $this->plugin->getDataBase(); $sql = $db->query("SELECT * FROM homes WHERE player = '$player';");