aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-23 13:00:01 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-23 13:00:01 +0200
commit1d57ff9e20696f95da8917cbaa1c77a7a74d210d (patch)
tree34bbc0bb1bc55840b482b88aa1b1953275d5354a /src/main/java/at/hannibal2/skyhanni/data
parenta0b6d9b95e58072dd96f4515b7a809083f140a71 (diff)
downloadSkyHanni-1d57ff9e20696f95da8917cbaa1c77a7a74d210d.tar.gz
SkyHanni-1d57ff9e20696f95da8917cbaa1c77a7a74d210d.tar.bz2
SkyHanni-1d57ff9e20696f95da8917cbaa1c77a7a74d210d.zip
added display to show last time a minion was cleared
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt36
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OtherMod.kt4
2 files changed, 34 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index f8ee0a299..98370fee7 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -1,9 +1,11 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.events.LocationChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.TabListUtils
import net.minecraft.client.Minecraft
import net.minecraft.network.play.server.S38PacketPlayerListItem
import net.minecraftforge.event.world.WorldEvent
@@ -17,6 +19,7 @@ class HypixelData {
var hypixel = false
var skyblock = false
var dungeon = false
+ var mode: String = ""
}
@SubscribeEvent
@@ -74,23 +77,48 @@ class HypixelData {
}
}
- var timerTick = 0
+ var tick = 0
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (!hypixel) return
if (event.phase != TickEvent.Phase.START) return
- timerTick++
+ tick++
- if (timerTick % 5 != 0) return
+ if (tick % 5 != 0) return
val newState = checkScoreboard()
- if (newState == skyblock) return
+ if (newState) {
+ checkMode()
+ }
+ if (newState == skyblock) return
skyblock = newState
}
+ private fun checkMode() {
+ var location = ""
+ var guesting = false
+ for (line in TabListUtils.getTabList()) {
+ if (line.startsWith("§r§b§lArea: ")) {
+ location = line.split(": ")[1].removeColor()
+ }
+ if (line == "§r Status: §r§9Guest§r") {
+ guesting = true
+ }
+ }
+ if (guesting) {
+ location = "$location guesting"
+ }
+
+ if (mode != location) {
+ LocationChangeEvent(location, mode).postAndCatch()
+ println("SkyHanni location change: '$location'")
+ mode = location
+ }
+ }
+
private fun checkScoreboard(): Boolean {
val minecraft = Minecraft.getMinecraft()
val world = minecraft.theWorld ?: return false
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherMod.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherMod.kt
index 04f2a4d4f..391d66975 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OtherMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OtherMod.kt
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.data
-import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigManager
import com.google.gson.JsonObject
import java.io.BufferedReader
@@ -38,5 +38,5 @@ enum class OtherMod(val modName: String, val configPath: String, val readKey: (B
}
fun getJson(reader: BufferedReader): JsonObject {
- return SkyHanniMod.gson.fromJson(reader, com.google.gson.JsonObject::class.java)
+ return ConfigManager.gson.fromJson(reader, com.google.gson.JsonObject::class.java)
} \ No newline at end of file