diff options
Diffstat (limited to 'src/main')
3 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index 8b352578a..76ed7c684 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -9,11 +9,10 @@ import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.time.LocalDate import java.time.LocalTime import java.time.OffsetDateTime -import java.time.ZoneId import java.time.ZoneOffset object BingoAPI { @@ -51,7 +50,7 @@ object BingoAPI { } private fun getStartOfMonthInMillis() = OffsetDateTime.of( - LocalDate.now(ZoneId.of("UTC")).plusDays(5).withDayOfMonth(1), + TimeUtils.getCurrentLocalDate().plusDays(5).withDayOfMonth(1), LocalTime.MIDNIGHT, ZoneOffset.UTC ).toEpochSecond() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index 4298edf21..021dd0ef6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -9,10 +9,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark +import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.TimeUtils.format import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.text.SimpleDateFormat +import java.time.Month import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds @@ -38,6 +40,7 @@ class TimeFeatures { } if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) { + if (TimeUtils.getCurrentLocalDate().month == Month.DECEMBER) return val timeTillNextYear = startOfNextYear.getValue().timeUntil() val alreadyInNextYear = timeTillNextYear > 5.days val text = if (alreadyInNextYear) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index 5bf6bfcf0..ecb842f63 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -3,6 +3,8 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import io.github.moulberry.notenoughupdates.util.SkyBlockTime +import java.time.LocalDate +import java.time.ZoneId import kotlin.time.Duration import kotlin.time.DurationUnit import kotlin.time.toDuration @@ -137,6 +139,8 @@ object TimeUtils { val year = this.year return "$month $day$daySuffix, Year $year $hour:${minute}$timeOfDay" // Early Winter 1st Year 300, 12:03pm } + + fun getCurrentLocalDate(): LocalDate = LocalDate.now(ZoneId.of("UTC")) } private const val FACTOR_SECONDS = 1000L |