public static function format(array $players, $withRoles = false)
{
$playerList = [];
foreach ($players as $player) {
$str = '@' . $player->getUsername();
if ($withRoles) {
$str .= ' (' . $player->role->getName() . ')';
}
$playerList[] = $str;
}
return implode(', ', $playerList);
}