Skip to content

Commit

Permalink
Backend: Removed Old TimeMark (#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 authored Apr 1, 2024
1 parent 1f96d1b commit 6ac1fba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.renderSingleLineWithItems
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.TimeMark
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.renderables.Renderable
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
Expand All @@ -25,15 +25,15 @@ object Year300RaffleEvent {
private val config get() = SkyHanniMod.feature.event.century
val displayItem by lazy { NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock) }

private var lastTimerReceived = TimeMark.never()
private var lastTimeAlerted = TimeMark.never()
private var lastTimerReceived = SimpleTimeMark.farPast()
private var lastTimeAlerted = SimpleTimeMark.farPast()

private var overlay: List<Any>? = null

@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
if (event.message == "§6§lACTIVE PLAYER! §eYou gained §b+1 Raffle Ticket§e!") {
lastTimerReceived = TimeMark.now()
lastTimerReceived = SimpleTimeMark.now()
}
}

Expand All @@ -54,15 +54,15 @@ object Year300RaffleEvent {
overlay = null
return
}
val p = lastTimerReceived.passedTime()
val p = lastTimerReceived.passedSince()
val timeLeft = if (p > 20.minutes) {
0.seconds
} else {
20.minutes - p
}
if (p.isFinite() && timeLeft < 1.seconds && lastTimeAlerted.passedTime() > 5.minutes && config.enableActiveAlert) {
if (p.isFinite() && timeLeft < 1.seconds && lastTimeAlerted.passedSince() > 5.minutes && config.enableActiveAlert) {
SoundUtils.centuryActiveTimerAlert.playSound()
lastTimeAlerted = TimeMark.now()
lastTimeAlerted = SimpleTimeMark.now()
}
overlay = listOf(
Renderable.itemStack(displayItem),
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt

This file was deleted.

0 comments on commit 6ac1fba

Please sign in to comment.