Skip to content

Commit

Permalink
Improvement + Fix: Unclaimed Eggs feature while busy (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
Obsidianninja11 authored Jul 6, 2024
1 parent e621664 commit a30e243
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ public class HoppityEggsConfig {
public String warpDestination = "nucleus";

@Expose
@ConfigOption(name = "Show during Contest", desc = "Show during a farming contest.")
@ConfigOption(name = "Show While Busy", desc = "Show while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc).")
@ConfigEditorBoolean
@FeatureToggle
public boolean showDuringContest = false;
public boolean showWhileBusy = false;

@Expose
@ConfigOption(name = "Warn While Busy", desc = "Warn while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc).")
@ConfigEditorBoolean
@FeatureToggle
public boolean warnWhileBusy = false;

@Expose
@ConfigOption(name = "Show Outside SkyBlock", desc = "Show on Hypixel even when not playing SkyBlock.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ object HoppityEggsManager {
fun onRenderOverlay(event: GuiRenderEvent) {
if (!isActive()) return
if (!config.showClaimedEggs) return
if (isBusy()) return
if (isBusy() && !config.showWhileBusy) return

val displayList =
HoppityEggType.entries.map { "§7 - ${it.formattedName} ${it.timeUntil().format()}" }.toMutableList()
Expand Down Expand Up @@ -253,7 +253,7 @@ object HoppityEggsManager {

private fun warn() {
if (!config.warnUnclaimedEggs) return
if (isBusy()) return
if (isBusy() && !config.warnWhileBusy) return
if (lastWarnTime.passedSince() < 30.seconds) return

lastWarnTime = now()
Expand All @@ -278,7 +278,7 @@ object HoppityEggsManager {
SoundUtils.repeatSound(100, 10, SoundUtils.plingSound)
}

private fun isBusy() = ReminderUtils.isBusy(config.showDuringContest)
private fun isBusy() = ReminderUtils.isBusy()

@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
Expand All @@ -288,6 +288,7 @@ object HoppityEggsManager {
"event.chocolateFactory.hoppityEggs.highlightHoppityShop",
)
event.move(44, "event.chocolateFactory.hoppityEggs", "event.hoppityEggs")
event.move(50, "event.hoppityEggs.showDuringContest", "event.hoppityEggs.showWhileBusy")
}

fun isActive() = (LorenzUtils.inSkyBlock || (LorenzUtils.onHypixel && config.showOutsideSkyblock)) &&
Expand Down

0 comments on commit a30e243

Please sign in to comment.