aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-17 02:17:14 +1000
committerGitHub <noreply@github.com>2024-06-16 18:17:14 +0200
commitb81197a01853cf819450aeac9c155935e424c5a5 (patch)
tree7685b3d9df1672a778c828b70f9a02aa9aa9b244 /src/main
parentcb828a9248e6c28da7abaa16cfbb9d112076bd24 (diff)
downloadskyhanni-b81197a01853cf819450aeac9c155935e424c5a5.tar.gz
skyhanni-b81197a01853cf819450aeac9c155935e424c5a5.tar.bz2
skyhanni-b81197a01853cf819450aeac9c155935e424c5a5.zip
Backend: Cleanup some scoreboard event stuff (#1940)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HotmData.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt8
12 files changed, 32 insertions, 32 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt
index c7c8925c7..72928fd25 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt
@@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.data.FameRanks.getFameRankByNameOrNull
import at.hannibal2.skyhanni.events.BitsUpdateEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
@@ -143,9 +143,9 @@ object BitsAPI {
)
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardChangeEvent) {
+ fun onScoreboardChange(event: ScoreboardUpdateEvent) {
if (!isEnabled()) return
- for (line in event.newList) {
+ for (line in event.scoreboard) {
val message = line.trimWhiteSpace().removeResets()
bitsScoreboardPattern.matchMatcher(message) {
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
index d232e49bb..3f2d54b31 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
@@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
@@ -644,10 +644,10 @@ enum class HotmData(
}
@SubscribeEvent
- fun onScoreboardUpdate(event: ScoreboardChangeEvent) {
+ fun onScoreboardUpdate(event: ScoreboardUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return
- event.newList.matchFirst(ScoreboardPattern.powderPattern) {
+ event.scoreboard.matchFirst(ScoreboardPattern.powderPattern) {
val type = HotmAPI.Powder.entries.firstOrNull { it.lowName == group("type") } ?: return
val amount = group("amount").formatLong()
val difference = amount - type.getCurrent()
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt
index 289c9c58b..47d38ef74 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt
@@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.events.ServerBlockChangeEvent
import at.hannibal2.skyhanni.events.mining.OreMinedEvent
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
@@ -102,8 +102,8 @@ object MiningAPI {
fun inColdIsland() = inAnyIsland(IslandType.DWARVEN_MINES, IslandType.MINESHAFT)
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardChangeEvent) {
- val newCold = event.newList.matchFirst(ScoreboardPattern.coldPattern) {
+ fun onScoreboardChange(event: ScoreboardUpdateEvent) {
+ val newCold = event.scoreboard.matchFirst(ScoreboardPattern.coldPattern) {
group("cold").toInt().absoluteValue
} ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
index 5c7f94aed..a5a8eb184 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.PurseChangeCause
import at.hannibal2.skyhanni.events.PurseChangeEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble
import at.hannibal2.skyhanni.utils.NumberUtil.million
@@ -36,8 +36,8 @@ object PurseAPI {
}
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardChangeEvent) {
- event.newList.matchFirst(coinsPattern) {
+ fun onScoreboardChange(event: ScoreboardUpdateEvent) {
+ event.scoreboard.matchFirst(coinsPattern) {
val newPurse = group("coins").formatDouble()
val diff = newPurse - currentPurse
if (diff == 0.0) return
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 72abf6bab..b24f08b04 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
-import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent
+import at.hannibal2.skyhanni.events.RawScoreboardUpdateEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.RegexUtils.matches
@@ -74,14 +74,14 @@ object ScoreboardData {
val list = fetchScoreboardLines().reversed()
val semiFormatted = list.map { cleanSB(it) }
if (semiFormatted != sidebarLines) {
- ScoreboardRawChangeEvent(sidebarLines, semiFormatted).postAndCatch()
+ RawScoreboardUpdateEvent(semiFormatted).postAndCatch()
sidebarLines = semiFormatted
}
sidebarLinesRaw = list
val new = formatLines(list)
if (new != sidebarLinesFormatted) {
- ScoreboardChangeEvent(sidebarLinesFormatted, new).postAndCatch()
+ ScoreboardUpdateEvent(new).postAndCatch()
sidebarLinesFormatted = new
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt
new file mode 100644
index 000000000..ac11a5bcb
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/RawScoreboardUpdateEvent.kt
@@ -0,0 +1,3 @@
+package at.hannibal2.skyhanni.events
+
+class RawScoreboardUpdateEvent(val rawScoreboard: List<String>) : LorenzEvent()
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt
deleted file mode 100644
index a9fa81a41..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-class ScoreboardChangeEvent(val oldList: List<String>, val newList: List<String>) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt
deleted file mode 100644
index c1f667ee3..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-class ScoreboardRawChangeEvent(val oldList: List<String>, val newList: List<String>) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt
new file mode 100644
index 000000000..9480e8061
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardUpdateEvent.kt
@@ -0,0 +1,3 @@
+package at.hannibal2.skyhanni.events
+
+class ScoreboardUpdateEvent(val scoreboard: List<String>) : LorenzEvent()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt
index 2ac40e252..02b62c0fb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt
@@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.events.garden.pests.PestSpawnEvent
import at.hannibal2.skyhanni.events.garden.pests.PestUpdateEvent
@@ -219,10 +219,10 @@ object PestAPI {
}
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardChangeEvent) {
+ fun onScoreboardChange(event: ScoreboardUpdateEvent) {
if (!GardenAPI.inGarden()) return
if (!firstScoreboardCheck) return
- checkScoreboardLines(event.newList)
+ checkScoreboardLines(event.scoreboard)
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
index 123748a53..647b2280b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
@@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.RiftEffigiesJson
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.events.RawScoreboardUpdateEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
-import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
@@ -80,10 +80,10 @@ object RiftBloodEffigies {
}
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardRawChangeEvent) {
+ fun onScoreboardChange(event: RawScoreboardUpdateEvent) {
if (!isEnabled()) return
- val line = event.newList.firstOrNull { it.startsWith("Effigies:") } ?: return
+ val line = event.rawScoreboard.firstOrNull { it.startsWith("Effigies:") } ?: return
val hearts = heartsPattern.matchMatcher(line) {
group("hearts")
} ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
index 92d4872c7..188283fbd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.ItemClickEvent
-import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.features.event.diana.DianaAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
@@ -42,9 +42,9 @@ object SlayerQuestWarning {
}
@SubscribeEvent
- fun onScoreboardChange(event: ScoreboardChangeEvent) {
- val slayerType = event.newList.nextAfter("Slayer Quest")
- val slayerProgress = event.newList.nextAfter("Slayer Quest", skip = 2) ?: "no slayer"
+ fun onScoreboardChange(event: ScoreboardUpdateEvent) {
+ val slayerType = event.scoreboard.nextAfter("Slayer Quest")
+ val slayerProgress = event.scoreboard.nextAfter("Slayer Quest", skip = 2) ?: "no slayer"
val new = slayerProgress.removeColor()
val slayerData = getSlayerData()