From 4416d272a774be2afd89cf5fbe05595d41349fc7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:23:03 +0200 Subject: adding setting for /viewrecipe Lower Case --- .../at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index f52ad10e3..0563f21ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -1,19 +1,22 @@ package at.hannibal2.skyhanni.features.commands +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.network.play.client.C01PacketChatMessage import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ViewRecipeCommand { + private val config get() = SkyHanniMod.feature.commands @SubscribeEvent fun onSendPacket(event: PacketEvent.SendEvent) { + if (!config.viewRecipeLowerCase) return val packet = event.packet if (packet is C01PacketChatMessage) { - if (packet.message == packet.message.uppercase()) return - val message = packet.message.lowercase() - if (message.startsWith("/viewrecipe ")) { + val message = packet.message + if (message == message.uppercase()) return + if (message.startsWith("/viewrecipe ", ignoreCase = true)) { event.isCanceled = true LorenzUtils.sendMessageToServer(message.uppercase()) } -- cgit