From d895459def5b5436000c86d0f61de582239ce593 Mon Sep 17 00:00:00 2001 From: Xiaro <62033805+Xiaro@users.noreply.github.com> Date: Thu, 31 Dec 2020 19:00:40 -0500 Subject: [PATCH] [fix] Command history --- .../me/zeroeightsix/kami/gui/mc/KamiGuiChat.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/gui/mc/KamiGuiChat.kt b/src/main/java/me/zeroeightsix/kami/gui/mc/KamiGuiChat.kt index d55e656d5..8d0bd1c45 100644 --- a/src/main/java/me/zeroeightsix/kami/gui/mc/KamiGuiChat.kt +++ b/src/main/java/me/zeroeightsix/kami/gui/mc/KamiGuiChat.kt @@ -15,16 +15,16 @@ import org.kamiblue.command.AbstractArg import org.kamiblue.command.AutoComplete import org.kamiblue.commons.extension.stream import org.lwjgl.input.Keyboard -import java.util.* import kotlin.math.min class KamiGuiChat( startStringIn: String, - historyBufferIn: String? = null, - sentHistoryCursorIn: Int? = null + private val historyBufferIn: String? = null, + private val sentHistoryCursorIn: Int? = null ) : GuiChat(startStringIn) { - init { + override fun initGui() { + super.initGui() historyBufferIn?.let { historyBuffer = it } sentHistoryCursorIn?.let { sentHistoryCursor = it } } @@ -79,11 +79,10 @@ class KamiGuiChat( } private fun displayNormalChatGUI() { - GuiChat(inputField.text).apply { - historyBuffer = this@KamiGuiChat.historyBuffer - sentHistoryCursor = this@KamiGuiChat.sentHistoryCursor - }.also { + GuiChat(inputField.text).also { mc.displayGuiScreen(it) + it.historyBuffer = this.historyBuffer + it.sentHistoryCursor = this.sentHistoryCursor } }