diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt | 15 |
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 { |