Send chat messages directly when the player does not have the required permissions for /say

This commit is contained in:
Username404-59 2021-07-13 14:35:37 +02:00
parent 73c55de5b4
commit 30b3985658
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 9 additions and 1 deletions

View File

@ -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
}
)
}
}