From 30b3985658b16d2048a2bf6602dbbe9043884daf Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Tue, 13 Jul 2021 14:35:37 +0200 Subject: [PATCH] Send chat messages directly when the player does not have the required permissions for /say --- .../fr/username404/snowygui/gui/feature/Macro.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 22d89f4..7d1c6f2 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 @@ -14,5 +14,13 @@ data class Macro( @JvmField var command: String, override var title: String = command ): ButtonImpl() { - override fun execAction() = Minecraft.getInstance().player!!.chat("/$command") + override fun execAction() = with(Minecraft.getInstance().player) { + chat( + "/$command".let { + if (it.startsWith("/say") && !hasPermissions(2)) { + it.drop(5) + } else it + } + ) + } } \ No newline at end of file