aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-18 19:51:12 +0200
committerGitHub <noreply@github.com>2024-05-18 19:51:12 +0200
commit6ee6072c64959811a389bafc23142663b06b7dce (patch)
treeadd871c71ff0f35826d9998f783ba48c310298d3 /src/main/java/at/hannibal2/skyhanni/data
parentf0aa9df4c216a0c9dedbd6bf186d17e3aa1717ed (diff)
downloadskyhanni-6ee6072c64959811a389bafc23142663b06b7dce.tar.gz
skyhanni-6ee6072c64959811a389bafc23142663b06b7dce.tar.bz2
skyhanni-6ee6072c64959811a389bafc23142663b06b7dce.zip
Fix: Reworked slayer warning (#1814)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt6
2 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 2995a38e2..4c021929b 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -6,7 +6,8 @@ import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent
import at.hannibal2.skyhanni.utils.StringUtils.matches
import net.minecraft.client.Minecraft
-import net.minecraft.network.play.server.S3BPacketScoreboardObjective
+import net.minecraft.network.play.server.S3CPacketUpdateScore
+import net.minecraft.network.play.server.S3EPacketTeams
import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -72,8 +73,15 @@ class ScoreboardData {
@SubscribeEvent(receiveCanceled = true)
fun onPacketReceive(event: PacketEvent.ReceiveEvent) {
- if (event.packet is S3BPacketScoreboardObjective) {
- dirty = true
+ if (event.packet is S3CPacketUpdateScore) {
+ if (event.packet.objectiveName == "update") {
+ dirty = true
+ }
+ }
+ if (event.packet is S3EPacketTeams) {
+ if (event.packet.name.startsWith("team_")) {
+ dirty = true
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
index 5f92da7ae..ec62adda0 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
@@ -98,10 +98,8 @@ object SlayerAPI {
private fun grabActiveSlayer(): SlayerType? {
for (line in ScoreboardData.sidebarLinesFormatted) {
- for (type in SlayerType.entries) {
- if (line.contains(type.displayName)) {
- return type
- }
+ SlayerType.getByName(line)?.let {
+ return it
}
}