aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
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 /src/main/java/at/hannibal2
parentd674606e0454239bc610330be923486efb19a93b (diff)
downloadskyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.tar.gz
skyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.tar.bz2
skyhanni-d7bd34e7a35c8908f1ed8dd1bb934cf36993789c.zip
Add SkyCrypt button to RPC (#1526)
Diffstat (limited to 'src/main/java/at/hannibal2')
-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
2 files changed, 17 insertions, 3 deletions
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) {