diff --git a/src/main/scala/net/psforever/login/psadmin/CmdListPlayers.scala b/src/main/scala/net/psforever/login/psadmin/CmdListPlayers.scala index a5fbca98..68af3775 100644 --- a/src/main/scala/net/psforever/login/psadmin/CmdListPlayers.scala +++ b/src/main/scala/net/psforever/login/psadmin/CmdListPlayers.scala @@ -6,6 +6,8 @@ import net.psforever.services.{InterstellarClusterService, ServiceManager} import scala.collection.mutable.Map import akka.actor.typed.scaladsl.adapter._ +private case class Player(name: String, faction_id: Int) + class CmdListPlayers(args: Array[String], services: Map[String, ActorRef]) extends Actor { private[this] val log = org.log4s.getLogger(self.path.name) @@ -22,19 +24,13 @@ class CmdListPlayers(args: Array[String], services: Map[String, ActorRef]) exten case InterstellarClusterService.PlayersResponse(players) => val data = Map[String, Any]() - data { - "player_count" - } = players.size - data { - "player_list" - } = Array[String]() + data("player_count") = players.size + data("player_list") = Array[Player]() if (players.isEmpty) { context.parent ! CommandGoodResponse("No players currently online!", data) } else { - data { - "player_list" - } = players.map(_.name) + data("player_list") = players.map(a => Player(a.name, a.faction.id)) context.parent ! CommandGoodResponse(s"${players.length} players online\n", data) } case default => log.error(s"Unexpected message $default") diff --git a/src/main/scala/net/psforever/services/InterstellarClusterService.scala b/src/main/scala/net/psforever/services/InterstellarClusterService.scala index 6596fe18..c96e199f 100644 --- a/src/main/scala/net/psforever/services/InterstellarClusterService.scala +++ b/src/main/scala/net/psforever/services/InterstellarClusterService.scala @@ -93,7 +93,6 @@ class InterstellarClusterService(context: ActorContext[InterstellarClusterServic } override def onMessage(msg: Command): Behavior[Command] = { - log.info(s"$msg") msg match { case GetPlayers(replyTo) => replyTo ! PlayersResponse(zones.flatMap(_.Players).toSeq)