diff --git a/src/LogHandler.kt b/src/LogHandler.kt index 9523e6b..986d0f0 100644 --- a/src/LogHandler.kt +++ b/src/LogHandler.kt @@ -83,6 +83,7 @@ open class listener : TailerListenerAdapter(){ + @Suppress("UNREACHABLE_CODE") fun handleMessage(nick : String, message: String){ @Suppress("NAME_SHADOWING") var message = message.strip().reduce() @@ -212,6 +213,7 @@ open class listener : TailerListenerAdapter(){ } } else { if (message.startsWith(config.varMap["${entries.keyword}"]!!.toUpperCase())) { + return //ignore signals for now, but keep the active Code for now //RATSIGNAL - CMDR killcrazycarl - System: COL 285 sector GM-V D2-110 (225.32 LY from Sothis) - Platform: XB - O2: OK - Language: English (en-US) (Case #1) //RATSIGNAL - CMDR test - System: COL 285 sector GM-V D2-110 (225.32 LY from Sothis) - Platform: XB - O2: OK - Language: English (en-US) (Case #1) //RATSIGNAL - CMDR Condor Aybarra - System: MN-t B3-6 Alrai Sector (not in EDDB) - Platform: PC - O2: OK - Language: English (en-US) - IRC Nickname: Condor_Aybarra (Case #3) diff --git a/src/Main.kt b/src/Main.kt index a55dcbe..25821df 100644 --- a/src/Main.kt +++ b/src/Main.kt @@ -287,8 +287,8 @@ class Rat(name : String, status : Status = Status(""), val uuid: String){ } - -var rescues : WatchableMutableList = WatchableMutableList(::updateScreen) +fun noop() = Unit +var rescues : WatchableMutableList = WatchableMutableList(::noop) diff --git a/src/WebSocketHandler.kt b/src/WebSocketHandler.kt index 7f50369..8ac3b2b 100644 --- a/src/WebSocketHandler.kt +++ b/src/WebSocketHandler.kt @@ -3,6 +3,7 @@ */ import com.google.gson.* +import kotlinx.coroutines.experimental.delay import kotlinx.coroutines.experimental.launch import org.java_websocket.handshake.ServerHandshake import java.lang.Exception @@ -215,11 +216,9 @@ fun parseRescueUpdate(meta: JsonObject, data: JsonArray){ .map { Rat(resolveRatName(it), Status(""), it)} )*/ - for (rat in ratsNow){ - if (!rats.map { it.uuid }.contains(rat)){ - rats.add(Rat(resolveRatName(rat), uuid=rat)) - } - } + ratsNow + .filterNot { rat -> rats.map { it.uuid }.contains(rat) } + .forEach { rats.add(Rat(resolveRatName(it), uuid= it)) } attributes.get("unidentifiedRats").asJsonArray.forEach { rats.add(Rat(it.asString, uuid="-1").setNameCorrectly())} /* @@ -245,6 +244,7 @@ fun parseRescueUpdate(meta: JsonObject, data: JsonArray){ } updateScreen() + launch{ delay(255); updateScreen()} }