PHP: $this->getServer()->unloadLevel($this->getServer()->getLevelByName("myname"));$this->getServer()->loadLevel($this->getServer()->getLevelByName("myname")); This is method I use in SW plugin.
+ Level must be loaded, if level isn't loaded and you try to unload it, server will crash. So I load all levels onLoad()
I don't know for what you want it. In my SW plugin, I need it for resetting arena maps. And it works.
I try this but console writes: [08:06:22] [Server thread/CRITICAL]: Could not execute task Tarik02\SkyWars\task\ExecuteTask: Invalid empty level name [08:06:22] [Server thread/CRITICAL]: pocketmine\utils\LevelException: "Invalid empty level name" (EXCEPTION) in "/src/pocketmine/Server__32bit" at line 1045
LOL PHP: $this->getServer()->unloadLevel($this->getServer()->getLevelByName("myname"));$this->getServer()->loadLevel("myname");