Skip to content

Commit

Permalink
Crying so hard right now
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Jan 10, 2025
1 parent 6f6c993 commit 8ce29da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/main/kotlin/org/polyfrost/polytime/client/PolyTimeConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,11 @@ object PolyTimeConfig : Config("${PolyTimeConstants.ID}.json", PolyTimeConstants
var backwardKeybind = KeybindHelper.builder().keys(UKeyboard.KEY_LBRACKET).does { if (time > 0) time -= 0.5f }.build()

init {
// initialize()
addDependency("time", "IRL Time") { if (!irlTime) Property.Display.DISABLED else Property.Display.SHOWN }
//addDependency("irlTime", "Fast Time") { !fastTime }
//addDependency("time", "IRL Time / Fast Time") { !irlTime && !fastTime }
//addDependency("fastTime", "IRL Time") { !irlTime }
//addDependency("fastSpeed", "IRL Time / Fast Time") { !irlTime && fastTime }
addDependency("time", "IRL Time") { if (irlTime) Property.Display.DISABLED else Property.Display.SHOWN }

registerKeybind(forwardKeyBind)
addDependency("forwardKeyBind", "IRL Time") { if (!irlTime) Property.Display.DISABLED else Property.Display.SHOWN }
addDependency("forwardKeyBind", "IRL Time") { if (irlTime) Property.Display.DISABLED else Property.Display.SHOWN }
registerKeybind(backwardKeybind)
addDependency("backwardKeybind", "IRL Time") { if (!irlTime) Property.Display.DISABLED else Property.Display.SHOWN }
addDependency("backwardKeybind", "IRL Time") { if (irlTime) Property.Display.DISABLED else Property.Display.SHOWN }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ object RealTimeHandler {

private val logger = LogManager.getLogger(RealTimeHandler::class.java)

private var currentlyUpdating = false

private lateinit var data: RealTimeData

@JvmStatic
Expand Down Expand Up @@ -65,6 +67,12 @@ object RealTimeHandler {
}

private fun populate() {
if (currentlyUpdating) {
return
}

currentlyUpdating = true

val (latitude, longitude) = obtainLongitudeLatitude() ?: return
val times = SunTimes.compute()
.at(latitude, longitude)
Expand Down Expand Up @@ -93,6 +101,8 @@ object RealTimeHandler {
}

logger.info("Obtained lunar phase: $currentLunarPhase")

currentlyUpdating = false
}

private fun obtainLongitudeLatitude(): Pair<Double, Double>? {
Expand Down

0 comments on commit 8ce29da

Please sign in to comment.