PHP: public function onJoin(PlayerJoinEvent) {var_dump($this->plugin->getDatabase()); //SQLite3 object$this->plugin->getDatabase()->exec("INSERT INTO database (date , time , player) VALUES ('$date' , '$time' , '$name' ");} I am very upset... Code: 2017-08-09 [13:22:21] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'WhatTheServer v1.0.0': Call to a member function exec() on null on test\eventmanager 2017-08-09 [13:22:21] [Server thread/CRITICAL]: Error: "Call to a member function exec() on null" (EXCEPTION) in "test/src/test/eventmanager" at line 32 Did I miss something?
Can you show what code $this->plugin->getDatabase() runs? Because that's probably the place where something is going wrong. Also, inside your var_dump() you wrote $the instead of $this.
PHP: //mainpublic $database;public function getDatabase() { return $this->database; }//database classclass SQLiteDataProvider { private $main, $database; public function __construct(main $plugin) { $this->main= $plugin; if(!file_exists($this->main->getDataFolder() . "database.db")){ $this->database = new \SQLite3($this->main->getDataFolder() . "database.db"); $this->database->exec("CREATE TABLE IF NOT EXISTS database (id INTEGER PRIMARY KEY AUTOINCREMENT , date INTEGER , time INTEGER , player TEXT , level TEXT , x INTEGER , y INTEGER , z INTEGER , event TEXT , block TEXT , item_transfer TEXT , join_date INTEGER , last_online INTEGER);"); } $this->main->database = $this->database; } EDIT : PHP: class SQLiteDataProvider { private $main, $database; public function __construct(main $plugin) { $this->main= $plugin; if(!file_exists($this->main->getDataFolder() . "database.db")){ $this->database = new \SQLite3($this->main->getDataFolder() . "database.db"); $this->database->exec("CREATE TABLE IF NOT EXISTS database (id INTEGER PRIMARY KEY AUTOINCREMENT , date INTEGER , time INTEGER , player TEXT , level TEXT , x INTEGER , y INTEGER , z INTEGER , event TEXT , block TEXT , item_transfer TEXT , join_date INTEGER , last_online INTEGER);");$this->main->database = $this->database; } } Problem fixed
you also need to have a base provider if you want to switch between formats (someone should write a quality tutorial about it)