Hello! How to make a command to check how many players played together on the server I kown how to create a command, but I don't know how to check the number of all players, even offline.
If you have only player data files in your players folder, you can count the number of files in your players folder. PHP: /** @var Server $server */$total_players = count(scandir($server->getDataPath() . "players/"));
Will not work! Added this to Broadcaster with: "ALLPLAYERS" => count(scandir($server->getDataPath() . "players/")); And error is: ParseError: "syntax error, unexpected '"ALLPLAYERS"' (T_CONSTANT_ENCAPSED_STRING), expecting ')'" (EXCEPTION) in "Broadcaster-master/src/Broadcaster/Broadcaster" at line 190
ErrorException: "count(): Parameter must be an array or an object that implements Countable" (EXCEPTION) in "Broadcaster-master/src/Broadcaster/Broadcaster" at line 190 Code: Code: public function formatMessage($message){ return $this->replaceVars($message, array( "MAXPLAYERS" => $this->getServer()->getMaxPlayers(), "TOTALPLAYERS" => count($this->getServer()->getOnlinePlayers()), "PREFIX" => $this->cfg["prefix"], "SUFFIX" => $this->cfg["suffix"], "TIME" => date($this->cfg["datetime-format"]), "ALLPLAYERS" => count($this->getServer()->getDataPath() . "players/") )); }
that's an issue with your code, not my snippet. I didn't mention "ALLPLAYERS" anywhere in my code. Anyway, this is not the code I provided: Check again.