diff options
Diffstat (limited to 'src/scalevalapokalypsi/Server/Server.scala')
-rw-r--r-- | src/scalevalapokalypsi/Server/Server.scala | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/scalevalapokalypsi/Server/Server.scala b/src/scalevalapokalypsi/Server/Server.scala index 16a2128..6bf21d4 100644 --- a/src/scalevalapokalypsi/Server/Server.scala +++ b/src/scalevalapokalypsi/Server/Server.scala @@ -51,8 +51,8 @@ class Server( this.receiveNewClient() this.readFromAll() this.clients.foreach(_.interpretData()) - this.writeClientDataToClients() this.makeClientsSing() + this.writeClientDataToClients() this.writeObservations() this.endGameForDeadClients() if this.canExecuteTurns then @@ -61,7 +61,7 @@ class Server( this.clients.foreach(c => this.writeToClient(this.turnStartInfo(c), c) ) - this.previousTurn = currentTimeMillis() / 1000 + this.previousTurn = currentTimeMillis().toDouble / 1000.0 if this.adventure.isDefined && this.joinAfterStart then this.clients.foreach( c => if c.isReadyForGameStart then this.adventure.foreach(a => @@ -76,7 +76,7 @@ class Server( then this.adventure = Some(Adventure(this.clients.names)) this.clients.foreach(startGameForClient(_)) - this.previousTurn = currentTimeMillis() / 1000 + this.previousTurn = currentTimeMillis().toDouble / 1000.0 /** Helper function to start the game for the specified client c. * MAY ONLY BE USED IF `this.adventure` is Some! @@ -120,13 +120,7 @@ class Server( private def makeClientsSing(): Unit = this.clients.foreach(c => - val target = c.player.flatMap(_.getSingEffectTarget) - target.foreach(t => - if c.player.exists(_.isSinging) && !c.clientHasSong then - val verse = t.getVerseAgainst - this.writeToClient(s"${SING_INDICATOR}$verse\r\n", c) - c.startSong(verse) - ) + c.startSongIfNeeded() ) /** Helper function to determine if the next turn can be taken */ |