[cleanup] Made CreditsCommand.kt code more efficient

For some reason sending a shit ton of messages is taxing in Minecraft

Signed-off-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
Dominika 2021-01-05 11:45:30 -05:00
parent cc04a17af5
commit 33306411f5
No known key found for this signature in database
GPG Key ID: B4A5A6DCA70F861F
1 changed files with 10 additions and 6 deletions

View File

@ -24,12 +24,16 @@ object CreditsCommand : ClientCommand(
} }
MessageSendHelper.sendChatMessage("Contributors to kami-blue/client: ${formatValue(contributors.size)}") MessageSendHelper.sendChatMessage("Contributors to kami-blue/client: ${formatValue(contributors.size)}")
contributors.forEach {
var name = it.name
knownNames[it.id]?.let { knownName -> name += " ($knownName)" }
MessageSendHelper.sendRawChatMessage("$name - &7${it.contributions}&f contributions") val formatted = StringBuilder().apply {
} contributors.forEach {
var name = it.name
alternateNames[it.id]?.let { knownName -> name += " ($knownName)" }
append("$name - &7${it.contributions}&f contributions")
}
}.toString()
MessageSendHelper.sendRawChatMessage(formatted)
} }
} }
@ -52,7 +56,7 @@ object CreditsCommand : ClientCommand(
val contributions: Int = 0 val contributions: Int = 0
) )
private val knownNames = hashMapOf( private val alternateNames = hashMapOf(
17222512 to "liv", 17222512 to "liv",
37771542 to "dewy", 37771542 to "dewy",
48992448 to "hub", 48992448 to "hub",