aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-10-26 16:19:14 +0100
committerGitHub <noreply@github.com>2023-10-26 17:19:14 +0200
commit1446e5aea63a4e3f672289b4f048920aa1e7234f (patch)
treeb3125c857895ddf29b132c20942e9d78db88f6d2 /src/main
parent038d2211032cc2187ef3332838dc20c9136fe7b7 (diff)
downloadskyhanni-1446e5aea63a4e3f672289b4f048920aa1e7234f.tar.gz
skyhanni-1446e5aea63a4e3f672289b4f048920aa1e7234f.tar.bz2
skyhanni-1446e5aea63a4e3f672289b4f048920aa1e7234f.zip
Allow IDs in viewrecipe to be lowercase (#593)
Adds support for lower case item ids to the Hypixel command /viewrecipe. #593
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt22
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 0e2e0fd9c..45042af50 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -71,6 +71,7 @@ import at.hannibal2.skyhanni.features.commands.PartyCommands
import at.hannibal2.skyhanni.features.commands.SendCoordinatedCommand
import at.hannibal2.skyhanni.features.commands.WarpIsCommand
import at.hannibal2.skyhanni.features.commands.WikiCommand
+import at.hannibal2.skyhanni.features.commands.ViewRecipeCommand
import at.hannibal2.skyhanni.features.commands.tabcomplete.GetFromSacksTabComplete
import at.hannibal2.skyhanni.features.commands.tabcomplete.PlayerTabComplete
import at.hannibal2.skyhanni.features.commands.tabcomplete.WarpTabComplete
@@ -420,6 +421,7 @@ class SkyHanniMod {
loadModule(WikiCommand())
loadModule(SendCoordinatedCommand())
loadModule(WarpIsCommand())
+ loadModule(ViewRecipeCommand())
loadModule(PartyCommands)
loadModule(SummoningMobManager())
loadModule(AreaMiniBossFeatures())
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
new file mode 100644
index 000000000..f52ad10e3
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
@@ -0,0 +1,22 @@
+package at.hannibal2.skyhanni.features.commands
+
+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 {
+
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+ if (packet is C01PacketChatMessage) {
+ if (packet.message == packet.message.uppercase()) return
+ val message = packet.message.lowercase()
+ if (message.startsWith("/viewrecipe ")) {
+ event.isCanceled = true
+ LorenzUtils.sendMessageToServer(message.uppercase())
+ }
+ }
+ }
+}