Remove inactive server code and music (#5017)

This commit is contained in:
SomeTroglodyte 2021-08-29 10:33:46 +02:00 committed by GitHub
parent 5a6a9c9759
commit 5403f28c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 58 deletions

View File

@ -68,7 +68,6 @@ project(":desktop") {
"implementation"("com.badlogicgames.gdx:gdx-tools:$gdxVersion") // This is for the TexturePacker class
"implementation"("com.github.MinnDevelopment:java-discord-rpc:v2.0.1")
"implementation"("io.ktor:ktor-server-netty:1.3.2")
}
}

View File

@ -15,13 +15,6 @@ import com.unciv.logic.GameSaver
import com.unciv.models.metadata.GameSettings
import com.unciv.models.translations.tr
import com.unciv.ui.utils.Fonts
import io.ktor.application.*
import io.ktor.http.*
import io.ktor.request.*
import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import java.util.*
import kotlin.concurrent.timer
@ -64,56 +57,6 @@ internal object DesktopLauncher {
LwjglApplication(game, config)
}
// Work in Progress?
@Suppress("unused")
private fun startMultiplayerServer() {
// val games = HashMap<String, GameSetupInfo>()
val files = HashMap<String, String>()
embeddedServer(Netty, 8080) {
routing {
get("/files/getFile/{fileName}") {
val fileName = call.parameters["fileName"]
if (!files.containsKey(fileName)) call.respond(HttpStatusCode.NotFound,
"Game with the name $fileName does not exist")
else call.respondText(files[fileName]!!)
}
post("/files/{fileName}") {
val fileName = call.parameters["fileName"]!!
val body = call.receiveText()
files[fileName] = body
}
//
// get("/getGame/{gameName}") {
// val gameName = call.parameters["gameName"]
// if(!games.containsKey(gameName)) call.respond(HttpStatusCode.NotFound,
// "Game with the name $gameName does not exist")
// else call.respondText(Json().toJson(games[gameName]))
// }
// get("/getGameNames"){
// call.respondText(Json().toJson(games.keys.toList()))
// }
// post("/addNewGame/{gameName}") {
// val gameName = call.parameters["gameName"]!!
// if (games.containsKey(gameName)) {
// call.respond(HttpStatusCode.NotAcceptable, "A game with the name $gameName already exists")
// return@post
// }
// val body = call.receiveText()
// val newGameInfo:GameSetupInfo
// try{
// newGameInfo = Json().apply { ignoreUnknownFields }.fromJson(GameSetupInfo::class.java, body)
// }
// catch (ex:Exception){
// call.respond(HttpStatusCode.NotAcceptable, "Could not deserialize json")
// return@post
// }
// games[gameName] = newGameInfo
// }
}
}.start()
}
private fun tryActivateDiscord(game: UncivGame) {
try {
/*