diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 17:23:03 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 17:23:03 +0200 |
commit | 4416d272a774be2afd89cf5fbe05595d41349fc7 (patch) | |
tree | af420c61b21b444bdb4ca6cb8e8cc8d941e82c33 /src/main/java/at/hannibal2 | |
parent | 1446e5aea63a4e3f672289b4f048920aa1e7234f (diff) | |
download | skyhanni-4416d272a774be2afd89cf5fbe05595d41349fc7.tar.gz skyhanni-4416d272a774be2afd89cf5fbe05595d41349fc7.tar.bz2 skyhanni-4416d272a774be2afd89cf5fbe05595d41349fc7.zip |
adding setting for /viewrecipe Lower Case
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java index c7234935d..6f7607f9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java @@ -69,7 +69,7 @@ public class CommandsConfig { public boolean useFandomWiki = false; @ConfigOption(name = "Party Commands", desc = "Shortens party commands and allows tab-completing for them. " + - "\n§eCommands: /pt /pp /pko /pk §7SkyBlock command §e/pt §7to check the play time still works.") + "\n§eCommands: /pt /pp /pko /pk §7SkyBlock command §e/pt §7to check the play time still works.") @Expose @ConfigEditorBoolean @FeatureToggle @@ -80,4 +80,10 @@ public class CommandsConfig { @ConfigEditorBoolean @FeatureToggle public boolean replaceWarpIs = false; + + @Expose + @ConfigOption(name = "/viewrecipe Lower Case", desc = "Adds support for lower case item IDs to the Hypixel command §e/viewrecipe§7.") + @ConfigEditorBoolean + @FeatureToggle + public boolean viewRecipeLowerCase = true; } 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()) } |