Decider admin
This commit is contained in:
@@ -4,14 +4,11 @@ import actors.UserActor._
|
||||
import akka.actor.{Actor, ActorRef}
|
||||
import akka.event.LoggingReceive
|
||||
import akka.util.Timeout
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import repository.DeciderRepository
|
||||
|
||||
import java.util
|
||||
import scala.collection.JavaConverters.iterableAsScalaIterableConverter
|
||||
import scala.collection.immutable.HashSet
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.Try
|
||||
|
||||
case class LobbyUser(name: String, actorRef: ActorRef)
|
||||
|
||||
@@ -23,7 +20,6 @@ case class DeciderMap(map: String, description: Option[String] = None, var isBan
|
||||
*/
|
||||
class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with LazyLogging {
|
||||
|
||||
val config = ConfigFactory.load()
|
||||
logger.info(s"Create lobby... host: ${hostUser.actorRef.path.name}")
|
||||
|
||||
|
||||
@@ -49,11 +45,12 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
|
||||
|
||||
|
||||
private val mapsLobby: Set[DeciderMap] = {
|
||||
val configMaps = config.getList(s"deciders.$deciderName.maps").asScala
|
||||
configMaps.map(e => {
|
||||
val mapConfig = e.unwrapped().asInstanceOf[util.ArrayList[String]].asScala
|
||||
DeciderMap(mapConfig.head, mapConfig.tail.headOption)
|
||||
}).toSet
|
||||
DeciderRepository.get(deciderName) match {
|
||||
case Some(d) =>
|
||||
d.maps.map(m => DeciderMap(m.map, m.description)).toSet
|
||||
case None =>
|
||||
Set.empty[DeciderMap]
|
||||
}
|
||||
}
|
||||
|
||||
hostUser.actorRef.tell(
|
||||
|
||||
Reference in New Issue
Block a user