Skip to content

Commit

Permalink
Backend: Scoreboard Event lazy (#2835)
Browse files Browse the repository at this point in the history
Co-authored-by: Empa <itsempa@users.noreply.github.com>
  • Loading branch information
ItsEmpa and ItsEmpa authored Oct 27, 2024
1 parent 4750db9 commit 6ff118b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ object ScoreboardData {
if (new != sidebarLinesFormatted) {
val old = sidebarLinesFormatted
sidebarLinesFormatted = new
ScoreboardUpdateEvent(old, new).postAndCatch()
ScoreboardUpdateEvent(new, old).postAndCatch()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package at.hannibal2.skyhanni.events

class ScoreboardUpdateEvent(
val full: List<String>,
val old: List<String>,
val scoreboard: List<String>,
) : LorenzEvent() {

val added by lazy { scoreboard - old.toSet() }
val removed by lazy { old - scoreboard.toSet() }
val added: List<String> = full - old.toSet()
val removed: List<String> = old - full.toSet()
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ object SlayerQuestWarning {

@SubscribeEvent
fun onScoreboardChange(event: ScoreboardUpdateEvent) {
val slayerType = event.scoreboard.nextAfter("Slayer Quest")
val slayerProgress = event.scoreboard.nextAfter("Slayer Quest", skip = 2) ?: "no slayer"
val slayerType = event.full.nextAfter("Slayer Quest")
val slayerProgress = event.full.nextAfter("Slayer Quest", skip = 2) ?: "no slayer"
val new = slayerProgress.removeColor()
val slayerData = getSlayerData()

Expand Down

0 comments on commit 6ff118b

Please sign in to comment.