fix some eros server list bugs

This commit is contained in:
Bixilon 2022-01-13 19:23:02 +01:00
parent 5c4b92e30b
commit 2f8a144965
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 8 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2021 Moritz Zwerger
* Copyright (C) 2020-2022 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -71,6 +71,7 @@ class PlayController : EmbeddedJavaFXController<Pane>(), Refreshable {
refreshList()
playTypeContentFX.children.setAll(this.root)
}
playTypeContentFX.children.setAll(currentController.root)
}
playTypeListViewFX.selectionModel.select(0)

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2021 Moritz Zwerger
* Copyright (C) 2020-2022 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -70,7 +70,6 @@ class ServerCardController : AbstractCardController<ServerCard>(), WatcherRefere
if (previous === item) {
return
}
previous?.unregister()
item ?: return
serverNameFX.text = item.server.name
@ -97,7 +96,7 @@ class ServerCardController : AbstractCardController<ServerCard>(), WatcherRefere
val ping = item.ping
ping::state.observeFX(this) { // ToDo: Don't register twice
if (ping.error != null || ping.lastServerStatus != null) {
if (this.item != item || ping.error != null || ping.lastServerStatus != null) {
return@observeFX
}

View File

@ -152,22 +152,19 @@ class StatusConnection(
return super.registerEvent(invoker)
}
if (!invoker.eventType.isAssignableFrom(ServerStatusReceiveEvent::class.java) && !invoker.eventType.isAssignableFrom(ConnectionErrorEvent::class.java) && !invoker.eventType.isAssignableFrom(StatusPongReceiveEvent::class.java)) {
return super.registerEvent(invoker)
}
super.registerEvent(invoker)
when {
invoker.eventType.isAssignableFrom(ConnectionErrorEvent::class.java) -> {
error?.let { invoker.invoke(ConnectionErrorEvent(this, EventInitiators.UNKNOWN, it)) } ?: super.registerEvent(invoker)
error?.let { invoker.invoke(ConnectionErrorEvent(this, EventInitiators.UNKNOWN, it)) }
}
invoker.eventType.isAssignableFrom(ServerStatusReceiveEvent::class.java) -> {
lastServerStatus?.let { invoker.invoke(ServerStatusReceiveEvent(this, EventInitiators.UNKNOWN, it)) } ?: super.registerEvent(invoker)
lastServerStatus?.let { invoker.invoke(ServerStatusReceiveEvent(this, EventInitiators.UNKNOWN, it)) }
}
invoker.eventType.isAssignableFrom(StatusPongReceiveEvent::class.java) -> {
lastPongEvent?.let { invoker.invoke(it) } ?: super.registerEvent(invoker)
lastPongEvent?.let { invoker.invoke(it) }
}
else -> TODO()
}
return invoker
}