From 7f2ca7f9217df45172d454b7e18c1acc3211282c Mon Sep 17 00:00:00 2001 From: Ronald Inglett <71849533+inglettronald@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:19:00 -0600 Subject: fix: garden changes + bad injection --- src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt') diff --git a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt index b69f0b4..38c62a7 100644 --- a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt @@ -11,7 +11,6 @@ object TablistUtils { private val areaPattern = "Area: (.+)".toRegex() private val speedPattern = "^Speed: (.+)".toRegex() private val visitorPattern = "Visitors: \\((.+)\\)".toRegex() - private val nextVisitorPattern = "Next Visitor: (.+)".toRegex() private val compostTimePattern = "Time Left: (.+)".toRegex() data class PersistentInfo( @@ -49,12 +48,14 @@ object TablistUtils { } visitorPattern.matchEntire(str)?.let { result -> - persistentInfo.numVisitors = result.groupValues[1].toInt() - return@forEach - } - - nextVisitorPattern.matchEntire(str)?.let { result -> persistentInfo.nextVisitorTime = result.groupValues[1] + var index = tablist!!.indexOf(it) + 1 + var visitors = 0 + while (tablist!!.get(index).displayName?.string != "") { + index++ + visitors++ + } + persistentInfo.numVisitors = visitors return@forEach } -- cgit