diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-15 20:56:01 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-15 20:56:01 +0200 |
commit | 6e5abff66a77294c1cbc9034f3fd31ef3b5b77f0 (patch) | |
tree | 87532307352e5c963906b91d8979185b3d4b43ee /src/main/java/at | |
parent | d036524d3a6182b844245efdf3d5f8b2882f1e31 (diff) | |
download | skyhanni-6e5abff66a77294c1cbc9034f3fd31ef3b5b77f0.tar.gz skyhanni-6e5abff66a77294c1cbc9034f3fd31ef3b5b77f0.tar.bz2 skyhanni-6e5abff66a77294c1cbc9034f3fd31ef3b5b77f0.zip |
fixed MultiFilter so that it does not require all fields anymore
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt index 13968c0ae..ddb8e4a73 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt @@ -13,14 +13,16 @@ class MultiFilter { startsWith.clear() endsWith.clear() - for (element in hideNpcSell["equals"].asJsonArray) { - equals.add(element.asString) - } - for (element in hideNpcSell["startsWith"].asJsonArray) { - startsWith.add(element.asString) - } - for (element in hideNpcSell["endsWith"].asJsonArray) { - endsWith.add(element.asString) + fill(hideNpcSell, "equals", equals) + fill(hideNpcSell, "startsWith", startsWith) + fill(hideNpcSell, "endsWith", endsWith) + } + + private fun fill(jsonObject: JsonObject, key: String, list: MutableList<String>) { + if (jsonObject.has(key)) { + for (element in jsonObject[key].asJsonArray) { + list.add(element.asString) + } } } |