I found a code. It may help you: PHP: count($this->getServer()->getLevelByName("World")->getPlayers());
[03:15:19] [Server thread/CRITICAL]: Error: "Call to undefined method slapper\entities\SlapperHuman::getServer()" (EXCEPTION) in "plugins/Slapper.phar/src/slapper/SlapperTrait" at line 83 i got this error i input this code
PHP: "{CreativePlot}" => count($this->getServer()->getLevelByName("CreativePlot")->getPlayers()); this is my line 83
PHP: count($this->getServer()->getLevelByName("World")->getPlayers()); i input this and i got this error [03:07:47] [Server thread/CRITICAL]: Error: "Call to undefined method slapper\entities\SlapperHuman::getServer()" (EXCEPTION) in "plugins/Slapper.phar/src/slapper/SlapperTrait" at line 84
[08:46:33] [Server thread/CRITICAL]: Error: "Call to undefined method slapper\entities\SlapperHuman::getServer()" (EXCEPTION) in "plugins/Slapper.phar/src/slapper/SlapperTrait" at line 87 how about this?
@RicardoMilos384's answer was wrong. Remove use pocketmine\Server; again and replace $this->getServer() with $player->getServer().
i got this code after i change and remove? [18:01:01] [Server thread/CRITICAL]: Error: "Call to a member function getPlayers() on null" (EXCEPTION) in "plugins/Slapper.phar/src/slapper/SlapperTrait" at line 86 this is my line 86 PHP: "{CreativePlot}" => count($player->getServer()->getLevelByName("CreativePlot")->getPlayers()),
same error [01:20:15] [Server thread/CRITICAL]: Error: "Call to a member function getPlayers() on null" (EXCEPTION) in "plugins/Slappcount.phar/src/slapper/SlapperTrait" at line 86 PHP: "{PvP}" => count($player->getServer()->getLevelByName("PvP")->getPlayers()), PS: i dont have PvP world