Hi, my plugin crashes with the following crash dump: Spoiler Code: PocketMine-Soft Crash Dump Sat Jun 27 15:55:48 AWST 2015 Error: Call to a member function getTiles() on null File: /SuperPE SG/src/SuperPE/Main Line: 130 Type: E_ERROR THIS CRASH WAS CAUSED BY A PLUGIN BAD PLUGIN: SG v1 Code: [121] public function getNextSpawn(){ [122] $this->spawns++; [123] $x = $this->prefs->get('spawn_locs')[$this->spawns][0]; [124] $y = $this->prefs->get('spawn_locs')[$this->spawns][1]; [125] $z = $this->prefs->get('spawn_locs')[$this->spawns][2]; [126] return (new Vector3($x, $y, $z)); [127] } [128] [129] public function refillChests(){ [130] foreach($this->getServer()->getLevelByName($this->prefs->get("world"))->getTiles() as $t){ [131] if($t instanceof Chest){ [132] if($t->isPaired()){ [133] $inv = $t->getInventory(); [134] }else{ [135] $inv = $t->getRealInventory(); [136] } [137] $inv->clearAll(); [138] foreach($this->prefs->get('chest_items') as $i){ [139] $inv->addItem(Item::get($i[0], $i[1], $i[2])); [140] } Backtrace: #0 /src/pocketmine/Server__32bit(0): pocketmine\Server->crashDump() #1 /SuperPE SG/src/SuperPE/Main(80): SuperPE\Main->refillChests() #2 /SuperPE SG/src/SuperPE/Main(69): SuperPE\Main->StartGame() #3 /src/pocketmine/plugin/PluginBase(86): SuperPE\Main->onEnable() #4 /DevTools_v1.10.0.phar/src/FolderPluginLoader/FolderPluginLoader(125): pocketmine\plugin\PluginBase->setEnabled() #5 /src/pocketmine/plugin/PluginManager(562): FolderPluginLoader\FolderPluginLoader->enablePlugin() #6 /src/pocketmine/Server__32bit(2030): pocketmine\plugin\PluginManager->enablePlugin() #7 /src/pocketmine/Server__32bit(2016): pocketmine\Server->enablePlugin() #8 /src/pocketmine/Server__32bit(1832): pocketmine\Server->enablePlugins() #9 /src/pocketmine/PocketMine(458): pocketmine\Server->__construct() #10 (1): () #11 (0): {main}() PocketMine-MP version: 1.5dev #245 [Protocol 27; API 1.12.0] Git commit: 0000000000000000000000000000000000000000 uname -a: Windows NT LEGOBOY 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586 PHP Version: 5.6.6 Zend version: 2.6.0 OS : WINNT, win Loaded plugins: DevTools 1.10.0 by PocketMine Team for API(s) 1.3.1 ManyWorlds 1.3.4 by aliuly for API(s) 1.10.0 SG 1 by SuperPE Network for API(s) 1.12.0 Can anyone help me? I have no idea how to fix it.
And are you sure that functions return "world", and are you sure that world exists? A plugin should always check the correctness of the config file
Why don't you check for null and return when it is null? Code: if ($this->getServer()->getLevelByName($this->prefs->get("world")) === null) { return }
Well it just looks exactly the same as this: https://github.com/luca28pet/SimpleHungerGames/blob/master/src/SimpleHungerGames/Main.php but if you say so.