tab list: only decorate player name, not custom display name

This commit is contained in:
Bixilon 2023-02-02 22:59:06 +01:00
parent 8f4e30c98d
commit 0519e1dead
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -1,6 +1,6 @@
/* /*
* Minosoft * Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger * Copyright (C) 2020-2023 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. * 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.
* *
@ -41,7 +41,7 @@ class PlayerAdditional(
var listed by observed(listed) var listed by observed(listed)
val tabDisplayName: ChatComponent val tabDisplayName: ChatComponent
get() = displayName?.let { team?.decorateName(it) ?: it } ?: ChatComponent.of(name) get() = displayName ?: ChatComponent.of(name).let { team?.decorateName(it) ?: it }
fun merge(data: AdditionalDataUpdate) { fun merge(data: AdditionalDataUpdate) {
spareMerge(data) spareMerge(data)
@ -55,11 +55,7 @@ class PlayerAdditional(
data.ping?.let { ping = it } data.ping?.let { ping = it }
data.hasDisplayName?.let { data.hasDisplayName?.let {
displayName = if (it) { displayName = if (it) data.displayName!! else null
data.displayName!!
} else {
ChatComponent.of(name)
}
} }
if (data.removeFromTeam) { if (data.removeFromTeam) {