I'm usign in a plugin: PHP: $onp = count($this->getServer()->getLevelByName($map)->getPlayers()); But when I start the plugin I get a error :'D Code: Fatal error: Call to a member function getPlayers() on null in /home/andrewbit4/Escritorio/PocketMine/plugins/PvP source/src/andrewbit4/PvP/Main.php on line 178
LEVEL NOT LOADED PHP: if(!$this->getServer()->isLevelLoaded(/*LevelName*/)){$this->getServer()->loadLevel(/*LevelName*/);}
Just to check. PHP: $map = $this->getServer()->getLevelByName('world_main');if($map instanceof \pocketmine\level\Level){ $playersCount = count($map->getPlayers());}