mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
network: handle tab list data (1.7)
This commit is contained in:
parent
2126c34012
commit
e3be42f686
@ -12,6 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
package de.bixilon.minosoft.protocol.packets.s2c.play.tab
|
package de.bixilon.minosoft.protocol.packets.s2c.play.tab
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.player.additional.PlayerAdditional
|
||||||
|
import de.bixilon.minosoft.protocol.ProtocolUtil.encodeNetwork
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||||
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
|
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
|
||||||
@ -19,6 +21,7 @@ import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
|
|||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class LegacyTabListS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
class LegacyTabListS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||||
val items: MutableMap<String, Int?> = mutableMapOf()
|
val items: MutableMap<String, Int?> = mutableMapOf()
|
||||||
@ -38,7 +41,24 @@ class LegacyTabListS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(connection: PlayConnection) {
|
override fun handle(connection: PlayConnection) {
|
||||||
TODO("Can not handle tab packet!")
|
for ((name, ping) in items) {
|
||||||
|
val uuid = UUID.nameUUIDFromBytes(name.encodeNetwork()) // TODO: map with players (if possible)
|
||||||
|
|
||||||
|
if (ping == null) {
|
||||||
|
connection.tabList.remove(uuid)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var item = connection.tabList.uuid[uuid]
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
item = PlayerAdditional(name)
|
||||||
|
|
||||||
|
connection.tabList.uuid[uuid] = item
|
||||||
|
connection.tabList.name[name] = item
|
||||||
|
}
|
||||||
|
item.ping = ping
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun log(reducedLog: Boolean) {
|
override fun log(reducedLog: Boolean) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user