aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorObsidian <108832807+Obsidianninja11@users.noreply.github.com>2024-05-15 23:55:23 -0800
committerGitHub <noreply@github.com>2024-05-16 09:55:23 +0200
commit388a656c95c745c8cced86931e9ab30e10e3bb9e (patch)
tree9dab00b107dbbcf7f52f02e6ffac393cb60b209e
parent5d4c57e8afa664d25be6fdaaf1e82a6e7b195ecd (diff)
downloadskyhanni-388a656c95c745c8cced86931e9ab30e10e3bb9e.tar.gz
skyhanni-388a656c95c745c8cced86931e9ab30e10e3bb9e.tar.bz2
skyhanni-388a656c95c745c8cced86931e9ab30e10e3bb9e.zip
Improvement: Better Hoppity Egg Warning (#1802)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt4
3 files changed, 23 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
index 1278542b5..04c915ff0 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
@@ -50,6 +51,16 @@ public class HoppityEggsConfig {
public boolean warnUnclaimedEggs = false;
@Expose
+ @ConfigOption(name = "Click to Warp", desc = "Makes the eggs ready chat message clickable to warp you to an island.")
+ @ConfigEditorBoolean
+ public boolean warpUnclaimedEggs = false;
+
+ @Expose
+ @ConfigOption(name = "Warp Destination", desc = "A custom island to warp to in the above option.")
+ @ConfigEditorText
+ public String warpDestination = "nucleus";
+
+ @Expose
@ConfigOption(name = "Show during Contest", desc = "Show during a farming contest.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
index 2b030f0c9..366f8d9dc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.DelayedRun
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
@@ -189,7 +190,14 @@ object HoppityEggsManager {
lastWarnTime = now()
val amount = HoppityEggType.entries.size
- ChatUtils.chat("All $amount Hoppity Eggs are ready to be found.!")
+ val message = "All $amount Hoppity Eggs are ready to be found!"
+ if (config.warpUnclaimedEggs) {
+ ChatUtils.clickableChat(
+ message,
+ onClick = { HypixelCommands.warp(config.warpDestination) },
+ "§eClick to /warp ${config.warpDestination}!"
+ )
+ } else ChatUtils.chat(message)
LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds)
SoundUtils.repeatSound(100, 10, SoundUtils.plingSound)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
index 728fa667b..1448cd250 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
@@ -126,6 +126,7 @@ object ChatUtils {
* Sends a message to the user that they can click and run an action
* @param message The message to be sent
* @param onClick The runnable to be executed when the message is clicked
+ * @param hover The string to be shown when the message is hovered
* @param expireAt When the click action should expire, default never
* @param prefix Whether to prefix the message with the chat prefix, default true
* @param prefixColor Color that the prefix should be, default yellow (§e)
@@ -135,6 +136,7 @@ object ChatUtils {
fun clickableChat(
message: String,
onClick: () -> Any,
+ hover: String = "§eClick here!",
expireAt: SimpleTimeMark = SimpleTimeMark.farFuture(),
prefix: Boolean = true,
prefixColor: String = "§e",
@@ -143,7 +145,7 @@ object ChatUtils {
val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else ""
chat(Text.text(msgPrefix + message) {
this.onClick(expireAt, oneTimeClick, onClick)
- this.hover = "§eClick here!".asComponent()
+ this.hover = hover.asComponent()
})
}