aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
diff options
context:
space:
mode:
authorronald <inglettronald@gmail.com>2023-07-30 12:45:32 -0500
committerronald <inglettronald@gmail.com>2023-07-30 12:45:32 -0500
commitb7643347ee38a8e376804e148e9d02d1c4b37b46 (patch)
tree6d707f305654ec8c305c2010d8d9975136dc92bd /src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
parent0599aa533cbacd9d4f22ebc529cc64f4e86e6edc (diff)
downloadDulkirMod-Fabric-b7643347ee38a8e376804e148e9d02d1c4b37b46.tar.gz
DulkirMod-Fabric-b7643347ee38a8e376804e148e9d02d1c4b37b46.tar.bz2
DulkirMod-Fabric-b7643347ee38a8e376804e148e9d02d1c4b37b46.zip
added visitor alert
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt')
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
index 881b3b9..b69f0b4 100644
--- a/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/TablistUtils.kt
@@ -1,6 +1,7 @@
package com.dulkirfabric.util
import com.dulkirfabric.DulkirModFabric.mc
+import com.dulkirfabric.events.AreaChangeEvent
import com.dulkirfabric.events.LongUpdateEvent
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.network.PlayerListEntry
@@ -35,7 +36,10 @@ object TablistUtils {
tablist!!.forEach {
val str = it.displayName?.string?.trim() ?: return@forEach
areaPattern.find(str)?.let { result ->
- persistentInfo.area = result.groupValues[1]
+ if (persistentInfo.area != result.groupValues[1]) {
+ AreaChangeEvent(result.groupValues[1], persistentInfo.area).post()
+ persistentInfo.area = result.groupValues[1]
+ }
return@forEach
}