aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
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
}
}