Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cofl ah search item #1743

Merged
merged 7 commits into from
May 16, 2024
Merged

Feature: cofl ah search item #1743

merged 7 commits into from
May 16, 2024

Conversation

hannibal002
Copy link
Owner

@hannibal002 hannibal002 commented May 8, 2024

What

Added an Item in AH search browser that allows searching for this item on https://sky.coflnet.com/

Images

image
opens https://sky.coflnet.com/item/HYPERION?range=day

Changelog New Features

  • Added an option in the Auction House search browser to search for the item on coflnet.com. - hannibal2

@hannibal002 hannibal002 added the Soon This Pull Request will be merged within the next couple of betas label May 8, 2024
@hannibal002 hannibal002 added this to the Version 0.25 milestone May 8, 2024
…house/AuctionHouseOpenPriceWebsite.kt

Co-authored-by: Äkwav <16632490+Ekwav@users.noreply.github.com>
@hannibal002 hannibal002 requested a review from Ekwav May 8, 2024 22:46
…AuctionHouseConfig.java

Co-authored-by: Äkwav <16632490+Ekwav@users.noreply.github.com>
Copy link
Collaborator

@CalMWolfs CalMWolfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just this

@hannibal002
Copy link
Owner Author

hannibal002 commented May 14, 2024

suddently this error happens

Stack trace
SkyHanni 0.25.Beta.26: Caught an URISyntaxException in AuctionHouseOpenPriceWebsite at SlotClickEvent: Illegal character in path at index 43: https://sky.coflnet.com/api/mod/open/Golden Dragon
 
Caused by java.net.URISyntaxException: Illegal character in path at index 43: https://sky.coflnet.com/api/mod/open/Golden Dragon
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at SH.utils.OSUtils.openBrowser(OSUtils.kt:16)
at SH.features.inventory.auctionhouse.AuctionHouseOpenPriceWebsite.onSlotClick(AuctionHouseOpenPriceWebsite.kt:83)
at SH.mixins.hooks.GuiContainerHook.onMouseClick(GuiContainerHook.kt:62)
at MC.client.gui.inventory.GuiContainer.handler$onMouseClick$zza000(GuiContainer.java:2307)
at MC.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:629)
at MC.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:388)
at MC.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:555)
at MC.client.gui.GuiScreen.handleInput(GuiScreen.java:524)
at MC.client.Minecraft.runTick(Minecraft.java:1674)
at MC.client.Minecraft.runGameLoop(Minecraft.java:1024)
at MC.client.Minecraft.run(Minecraft.java:349)
at MC.client.main.Main.main(Main.java:124)

when i try to fix it with this

Patch
Index: src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt(revision 0a5ccaa3d6be5113c8f4d6def9d966a1df720712)
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt(date 1715673321561)
@@ -17,6 +17,7 @@
 import net.minecraft.item.ItemStack
 import net.minecraftforge.fml.common.eventhandler.EventPriority
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.net.URLEncoder
 import kotlin.time.Duration.Companion.seconds
 
 class AuctionHouseOpenPriceWebsite {
@@ -79,7 +80,8 @@
         if (event.slotId != 8) return
         event.isCanceled = true
         if (lastClick.passedSince() > 0.3.seconds) {
-            val url = "https://sky.coflnet.com/api/mod/open/$searchTerm"
+            val search = URLEncoder.encode(searchTerm, "UTF-8")
+            val url = "https://sky.coflnet.com/api/mod/open/$search"
             OSUtils.openBrowser(url)
             lastClick = SimpleTimeMark.now()
         }
then the website links me to start page instead to the item page

Copy link
Collaborator

@CalMWolfs CalMWolfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

@hannibal002 hannibal002 merged commit c7b6a06 into beta May 16, 2024
7 checks passed
@hannibal002 hannibal002 deleted the cofl-ah-search-item branch May 16, 2024 22:48
@github-actions github-actions bot removed the Soon This Pull Request will be merged within the next couple of betas label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants