From 840e04181768ddbbe400a8bd81f745e135ed508b Mon Sep 17 00:00:00 2001 From: Username404 Date: Fri, 28 Apr 2023 17:08:20 +0200 Subject: [PATCH] Use a different function to replace /say when permissions are not high enough Signed-off-by: Username404 --- .../kotlin/fr/username404/snowygui/gui/feature/Macro.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt index 30eb7d1..2be5877 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt @@ -15,12 +15,12 @@ data class Macro( override var title: String = command ): ButtonImpl() { override fun execAction(): Unit = with(Minecraft.getInstance().player!!) { - connection.sendCommand( + connection.run { command.let { if (it.startsWith("say") && !hasPermissions(2)) { - it.drop(4) - } else it + sendChat(it.drop(4)) + } else sendCommand(it) } - ) + } } } \ No newline at end of file