Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into fork/fix-choc-shop-profit-calcula…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
hannibal002 committed May 16, 2024
2 parents 14016df + 388a656 commit 8d4a3f5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;

Expand Down Expand Up @@ -49,6 +50,16 @@ public class HoppityEggsConfig {
@FeatureToggle
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand All @@ -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()
})
}

Expand Down

0 comments on commit 8d4a3f5

Please sign in to comment.