aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chat
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-10-21 22:56:53 +1100
committerGitHub <noreply@github.com>2023-10-21 13:56:53 +0200
commit526365859a27d54b7ea5c07c08b301650c15ea0e (patch)
treeddf772f564d85caf3dbe73c66c032affdf69281f /src/main/java/at/hannibal2/skyhanni/features/chat
parenta98927303854058ad2d7a0d8bb88265c54139614 (diff)
downloadskyhanni-526365859a27d54b7ea5c07c08b301650c15ea0e.tar.gz
skyhanni-526365859a27d54b7ea5c07c08b301650c15ea0e.tar.bz2
skyhanni-526365859a27d54b7ea5c07c08b301650c15ea0e.zip
Backend: Serialise all constants and add repo error messages and status (#605)
Backend: Serialise all constants and add repo error messages and status #605
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
index 6de251af5..e4db8ee3b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.MultiFilter
+import at.hannibal2.skyhanni.utils.jsonobjects.PlayerChatFilterJson
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PlayerChatFilter {
@@ -29,18 +30,16 @@ class PlayerChatFilter {
var countCategories = 0
var countFilters = 0
- val data = event.getConstant("PlayerChatFilter")
- for (category in data["filters"].asJsonArray) {
- val jsonObject = category.asJsonObject
- val description = jsonObject["description"].asString
+ val data = event.getConstant<PlayerChatFilterJson>("PlayerChatFilter")
+ for (category in data.filters) {
+ val description = category.description
val filter = MultiFilter()
- filter.load(jsonObject)
+ filter.load(category)
filters[description] = filter
countCategories++
countFilters += filter.count()
}
-
LorenzUtils.debug("Loaded $countFilters filters in $countCategories categories from repo")
}
}