diff options
author | Appability <appable@icloud.com> | 2022-10-12 20:48:51 -0700 |
---|---|---|
committer | Appability <appable@icloud.com> | 2022-10-12 20:48:51 -0700 |
commit | c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8 (patch) | |
tree | f362a5f60f31e27f1567c7319a78d861b19430a7 /src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt | |
parent | 03728b81851af00cd265fadd4ce6eaa3a8066dcb (diff) | |
download | AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.gz AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.bz2 AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.zip |
uh a lot of things
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt')
-rw-r--r-- | src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt b/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt new file mode 100644 index 0000000..ba21a04 --- /dev/null +++ b/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt @@ -0,0 +1,28 @@ +package com.ambientaddons.utils.dungeon + +import com.ambientaddons.utils.Extensions.stripControlCodes +import com.ambientaddons.utils.Area +import com.ambientaddons.utils.SkyBlock +import com.ambientaddons.utils.TabListUtils +import com.ambientaddons.utils.text +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent + +object DungeonPlayers { + private val playerRegex = Regex("^\\[\\d{1,3}] (?<name>[\\w]{3,16}) (?:.*)*\\((?:(?<class>Healer|Tank|Berserk|Mage|Archer) (?<level>[XVIL0]+)|(?<status>DEAD|EMPTY))\\)") + var playerCount = 0 + private val playerSlots = listOf(5, 9, 13, 17, 1) + private var ticks = 0 + + @SubscribeEvent + fun onTick(event: ClientTickEvent) { + if (SkyBlock.area != Area.Dungeon) return + if (ticks % 10 == 0) { + val rawPlayers = TabListUtils.fetchTabEntries().let { tabEntries -> + playerSlots.map { tabEntries[it].text.stripControlCodes() } + } + playerCount = rawPlayers.size + } + ticks++ + } +}
\ No newline at end of file |