chat components: reduce memory footprint for empty messages

This commit is contained in:
Bixilon 2022-02-16 22:45:38 +01:00
parent 8660e0a611
commit 8f780596ab
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -79,12 +79,12 @@ interface ChatComponent {
companion object {
val EMPTY = ChatComponent.of("")
val EMPTY = TextComponent("")
@JvmOverloads
fun of(raw: Any? = null, translator: Translator? = null, parent: TextComponent? = null, ignoreJson: Boolean = false, restrictedMode: Boolean = false): ChatComponent {
if (raw == null) {
return BaseComponent()
return EMPTY
}
if (raw is ChatComponent) {
return raw