Whenever I try to generate a level with a plugin: PHP: <?phpdeclare(strict_types=1);namespace CortexPE;use pocketmine\level\generator\Generator;use pocketmine\level\Level;use pocketmine\plugin\PluginBase;class Main extends PluginBase { public function onLoad(){ $this->generateLevels(); } public function generateLevels(){ $this->getServer()->generateLevel("test", null, Generator::getGenerator("FLAT")); }} I only get this error: Code: [08:33:36] [Server thread/ERROR]: pocketmine.level.generateError [08:33:36] [Server thread/CRITICAL]: Error: "Class name must be a valid object or a string" (EXCEPTION) in "src/pocketmine/Server" at line 1076 [08:33:36] [Server thread/DEBUG]: #0 plugins/TESTERPLUGIN/src/CortexPE/Main(17): pocketmine\Server->generateLevel(string test, integer -613950673, string pocketmine\level\generator\normal\Normal) [08:33:36] [Server thread/DEBUG]: #1 plugins/TESTERPLUGIN/src/CortexPE/Main(13): CortexPE\Main->generateLevels() [08:33:36] [Server thread/DEBUG]: #2 plugins/DevTools.phar/src/FolderPluginLoader/FolderPluginLoader(115): CortexPE\Main->onLoad() [08:33:36] [Server thread/DEBUG]: #3 plugins/DevTools.phar/src/FolderPluginLoader/FolderPluginLoader(66): FolderPluginLoader\FolderPluginLoader->initPlugin(CortexPE\Main object, pocketmine\plugin\PluginDescription object, string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\TESTERPLUGIN, string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\TESTERPLUGIN) [08:33:36] [Server thread/DEBUG]: #4 src/pocketmine/plugin/PluginManager(161): FolderPluginLoader\FolderPluginLoader->loadPlugin(string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\TESTERPLUGIN) [08:33:36] [Server thread/DEBUG]: #5 src/pocketmine/plugin/PluginManager(305): pocketmine\plugin\PluginManager->loadPlugin(string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\TESTERPLUGIN, array Array()) [08:33:36] [Server thread/DEBUG]: #6 plugins/DevTools.phar/src/DevTools/DevTools(47): pocketmine\plugin\PluginManager->loadPlugins(string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\, array Array()) [08:33:36] [Server thread/DEBUG]: #7 src/pocketmine/plugin/PluginBase(90): DevTools\DevTools->onEnable() [08:33:36] [Server thread/DEBUG]: #8 src/pocketmine/plugin/PharPluginLoader(122): pocketmine\plugin\PluginBase->setEnabled(boolean 1) [08:33:36] [Server thread/DEBUG]: #9 src/pocketmine/plugin/PluginManager(610): pocketmine\plugin\PharPluginLoader->enablePlugin(DevTools\DevTools object) [08:33:36] [Server thread/DEBUG]: #10 src/pocketmine/Server(1940): pocketmine\plugin\PluginManager->enablePlugin(DevTools\DevTools object) [08:33:36] [Server thread/DEBUG]: #11 src/pocketmine/Server(1926): pocketmine\Server->enablePlugin(DevTools\DevTools object) [08:33:36] [Server thread/DEBUG]: #12 src/pocketmine/Server(1635): pocketmine\Server->enablePlugins(integer 0) [08:33:36] [Server thread/DEBUG]: #13 src/pocketmine/PocketMine(558): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\, string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\, string C:\Users\CortexPE\Desktop\MCPE Server Softwares\PocketMine-MP\plugins\) Any suggestions on why the error occurs? I'm using PMMP's latest commit...
Check you are passing the correct types required by generateLevel(): https://github.com/pmmp/PocketMine-...465ae6e085e9b/src/pocketmine/Server.php#L1049
PocketMine generated this world but it Worked... The plugin generated one however, didn't. And yeah... they're the same type.
According to this, Generator::getGenerator() returns a Generator object, which you are passing to generateLevel(), which expects a string, a " Class name that extends pocketmine\level\generator\Noise". Also, check this.
Tried onEnable (Just updated a minute ago) and it still didn't work for me... SAME ERROR. Updated via: Code: git fetch origin && git reset --hard origin Using: Code: $this->getServer()->generateLevel("test", null, Generator::getGenerator("FLAT")); wtf.
> https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Server.php#L1076 > A method on $provider is being called, $provider being a string Check level-settings.default-format.
If your plugin load order is STARTUP, change it to POSTWORLD. Level providers and generators are registered after STARTUP-order plugins are enabled. Reference: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Server.php#L1635