diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
3 files changed, 17 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index 34196acbe..a236daf4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -16,10 +16,17 @@ class ServerRestartTitle { private val config get() = SkyHanniMod.feature.misc - private val restartPattern by RepoPattern.pattern( - "misc.serverrestart.restart", - "§cServer closing: (?<minutes>\\d+):(?<seconds>\\d+) §8.*" - ) + companion object { + private val restartingGroup = RepoPattern.group("features.misc.serverrestart") + private val restartingPattern by restartingGroup.pattern( + "time", + "§cServer closing: (?<minutes>\\d+):(?<seconds>\\d+) ?§8.*" + ) + val restartingGreedyPattern by restartingGroup.pattern( + "greedy", + "§cServer closing:.*" + ) + } @SubscribeEvent fun onTick(event: LorenzTickEvent) { @@ -29,7 +36,7 @@ class ServerRestartTitle { if (!event.repeatSeconds(1)) return for (line in ScoreboardData.sidebarLinesFormatted) { - restartPattern.matchMatcher(line) { + restartingPattern.matchMatcher(line) { try { val minutes = group("minutes").toInt().minutes val seconds = group("seconds").toInt().seconds @@ -39,9 +46,9 @@ class ServerRestartTitle { LorenzUtils.sendTitle("§cServer Restart in §b$time", 2.seconds) } catch (e: Throwable) { ErrorManager.logErrorWithData( - e, "Error reading server restart time from socreboard", + e, "Error reading server restart time from scoreboard", "line" to line, - "restartPattern" to restartPattern.pattern(), + "restartPattern" to restartingPattern.pattern(), ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt index 07473f9d9..bba2ff6aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt @@ -2,14 +2,12 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeResets import at.hannibal2.skyhanni.utils.StringUtils.removeSFormattingCode import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern -import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // heavily inspired by SBA code @@ -99,7 +97,7 @@ object TabListReader { } private fun parseFooterAsColumn(): TabColumn? { - val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay + val tabList = TabListData.getPlayerTabOverlay() if (tabList.footer_skyhanni == null) { return null diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt index c6aa9a510..6f2d5d636 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt @@ -3,11 +3,11 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SkipTabListLineEvent -import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay import at.hannibal2.skyhanni.utils.CollectionUtils.filterToMutable import at.hannibal2.skyhanni.utils.KeyboardManager.isActive import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.TabListData.Companion.getPlayerTabOverlay import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui @@ -78,7 +78,7 @@ object TabListRenderer { } var totalHeight = maxLines * lineHeight - val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay + val tabList = getPlayerTabOverlay() var header = listOf<String>() if (tabList.header_skyhanni != null) { |
