aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrady <thatgravyboat@gmail.com>2024-04-27 08:04:42 -0230
committerGitHub <noreply@github.com>2024-04-27 12:34:42 +0200
commitd7bd34e7a35c8908f1ed8dd1bb934cf36993789c (patch)
tree40854cc50e6b5c7f06430e89de0633e31953c909
parentd674606e0454239bc610330be923486efb19a93b (diff)
downloadskyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.tar.gz
skyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.tar.bz2
skyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.zip
Add SkyCrypt button to RPC (#1526)
-rw-r--r--CONTRIBUTING.md5
-rw-r--r--build.gradle.kts3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt15
4 files changed, 20 insertions, 8 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1a58d0b64..28142d32b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -148,10 +148,7 @@ folder for how to properly do this. You also may have to disable repo auto updat
### Discord IPC
DiscordIPC is a service that SkyHanni uses to send information from SkyBlock to Discord in Rich Presence. <br>
-Specifically, we use [NetheriteMiner's Fork](https://github.com/NetheriteMiner/DiscordIPC) of a fork of a fork of a fork of
-the [original](https://github.com/jagrosh/DiscordIPC).
-For info on usage, look
-at [DiscordRPCManager.kt](https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt)
+For info on usage, look at [DiscordRPCManager.kt](https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt)
### Auto Updater
diff --git a/build.gradle.kts b/build.gradle.kts
index 5261ab200..9bb903744 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -51,6 +51,7 @@ repositories {
maven("https://repo.nea.moe/releases")
maven("https://maven.notenoughupdates.org/releases")
maven("https://repo.hypixel.net/repository/Hypixel/")
+ maven("https://maven.teamresourceful.com/repository/thatgravyboat/")
}
val shadowImpl: Configuration by configurations.creating {
@@ -79,7 +80,7 @@ dependencies {
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")
// Discord RPC client
- shadowImpl("com.github.NetheriteMiner:DiscordIPC:3106be5") {
+ shadowImpl("com.jagrosh:DiscordIPC:0.5") {
exclude(module = "log4j")
because("Different version conflicts with Minecraft's Log4J")
exclude(module = "gson")
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java
index 53def7ffb..71bddc4ea 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java
@@ -92,6 +92,11 @@ public class DiscordRPCConfig {
@ConfigEditorDropdown
public Property<LineEntry> auto = Property.of(NOTHING);
+ @Expose
+ @ConfigOption(name = "Show Button for SkyCrypt", desc = "Adds a button to the RPC that opens your SkyCrypt profile.")
+ @ConfigEditorBoolean
+ public Property<Boolean> showSkyCryptButton = Property.of(true);
+
public enum LineEntry implements HasLegacyId {
NOTHING("Nothing", 0),
LOCATION("Location", 1),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
index 606dd7480..2f8b40212 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.SkyHanniMod.Companion.feature
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.LineEntry
import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry
+import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.jsonobjects.repo.StackingEnchantData
import at.hannibal2.skyhanni.data.jsonobjects.repo.StackingEnchantsJson
import at.hannibal2.skyhanni.events.ConfigLoadEvent
@@ -26,6 +27,7 @@ import com.google.gson.JsonObject
import com.jagrosh.discordipc.IPCClient
import com.jagrosh.discordipc.IPCListener
import com.jagrosh.discordipc.entities.RichPresence
+import com.jagrosh.discordipc.entities.RichPresenceButton
import kotlinx.coroutines.launch
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.network.FMLNetworkEvent
@@ -134,13 +136,20 @@ object DiscordRPCManager : IPCListener {
// TODO, change functionality to use enum rather than ordinals
secondLine = getStatusByConfigId(config.secondLine.get().ordinal)
firstLine = getStatusByConfigId(config.firstLine.get().ordinal)
- val presence: RichPresence = RichPresence.Builder()
+
+ var presence = RichPresence.Builder()
.setDetails(firstLine.getDisplayString())
.setState(secondLine.getDisplayString())
.setStartTimestamp(startTimestamp!!)
.setLargeImage(discordIconKey, location)
- .build()
- client?.sendRichPresence(presence)
+ if (config.showSkyCryptButton.get()) {
+ val skyCryptUrl = "https://sky.shiiyu.moe/stats/${LorenzUtils.getPlayerName()}/${HypixelData.profileName}"
+ presence = presence.setButtons(arrayOf(
+ RichPresenceButton(skyCryptUrl, "Open SkyCrypt Profile")
+ ))
+ }
+
+ client?.sendRichPresence(presence.build())
}
override fun onReady(client: IPCClient) {