aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-10-06 22:49:45 +0200
committerGitHub <noreply@github.com>2024-10-06 22:49:45 +0200
commitff119419cce3e192012aee9e438911ffeb8d8519 (patch)
tree5936dab285065d722a2f73ae755119fa9f696fa0
parent497d652aa83ed81e04f9400ae84362642585dfca (diff)
downloadskyhanni-ff119419cce3e192012aee9e438911ffeb8d8519.tar.gz
skyhanni-ff119419cce3e192012aee9e438911ffeb8d8519.tar.bz2
skyhanni-ff119419cce3e192012aee9e438911ffeb8d8519.zip
Fixed /viewrecipe replace breaking pages (#2679)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt15
1 files changed, 12 insertions, 3 deletions
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 e3d6a5713..dbaf037ca 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils.senderIsSkyhanni
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NumberUtil.isInt
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -30,12 +31,20 @@ object ViewRecipeCommand {
if (!config.viewRecipeLowerCase) return
if (event.senderIsSkyhanni()) return
- val item = pattern.matchMatcher(event.message.lowercase()) {
- group("item").uppercase().replace(" ", "_")
+ val input = pattern.matchMatcher(event.message.lowercase()) {
+ group("item").uppercase()
} ?: return
+ val args = input.split(" ")
+ val endsWithPageNumber = args.last().isInt()
+ val finalCommand = if (endsWithPageNumber) {
+ "${args.dropLast(1).joinToString("_")} ${args.last()}"
+ } else {
+ input.replace(" ", "_")
+ }
+
event.cancel()
- HypixelCommands.viewRecipe(item)
+ HypixelCommands.viewRecipe(finalCommand)
}
val list by lazy {