aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-31 11:47:38 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-31 11:47:38 +0200
commit176ff2a1020f741e90fe77ef64dedd401ccbaa8b (patch)
treeca0a9039d5ecc85e02c6ea7ca94dfb20bbf7eb51 /src/main/java/at/hannibal2
parentb7099ea6ba40ae5d832266bfbedea5686068e833 (diff)
downloadskyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.tar.gz
skyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.tar.bz2
skyhanni-176ff2a1020f741e90fe77ef64dedd401ccbaa8b.zip
Soft fixing all RepositoryReloadEvent npe errors
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt2
10 files changed, 23 insertions, 20 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 2510aa0b0..af0d1b805 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
@@ -30,7 +30,7 @@ class PlayerChatFilter {
var countFilters = 0
try {
- val data = event.getConstant("PlayerChatFilter")!!
+ val data = event.getConstant("PlayerChatFilter") ?: return
for (category in data["filters"].asJsonArray) {
val jsonObject = category.asJsonObject
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
index 16fee2d35..9f6527148 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
@@ -12,7 +12,7 @@ class SeaCreatureManager {
var counter = 0
try {
- val data = event.getConstant("SeaCreatures")!!
+ val data = event.getConstant("SeaCreatures") ?: return
for (variant in data.entrySet().map { it.value.asJsonObject }) {
val chatColor = variant["chat_color"].asString
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 5c2f569cb..8fe0f2272 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -421,7 +421,7 @@ class ComposterOverlay {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
- garden = event.getConstant<GardenJson>("Garden")!!
+ garden = event.getConstant<GardenJson>("Garden")
updateOrganicMatterFactors()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt
index 789e8e241..84bbf4a4b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt
@@ -13,13 +13,13 @@ class GardenVisitorColorNames {
try {
val mapColor = mutableMapOf<String, String>()
val mapItems = mutableMapOf<String, List<String>>()
- val garden = event.getConstant("Garden")!!
- for ((name, element) in garden["visitors"].asJsonObject.entrySet()) {
- val jsonObject = element.asJsonObject
- val rarity = jsonObject["rarity"].asString
- mapColor[name] = getColor(rarity)
- mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString }
-
+ event.getConstant("Garden")?.let { garden ->
+ for ((name, element) in garden["visitors"].asJsonObject.entrySet()) {
+ val jsonObject = element.asJsonObject
+ val rarity = jsonObject["rarity"].asString
+ mapColor[name] = getColor(rarity)
+ mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString }
+ }
}
visitorColor = mapColor
visitorItems = mapItems
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
index 2faac03bf..462414dea 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -47,17 +47,20 @@ class HideNotClickableItems {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
try {
- val hideNotClickableItems = event.getConstant("HideNotClickableItems")!!
+ event.getConstant("TradeNpcs")?.let {
+ tradeNpcFilter.load(it)
+ }
+
+ val hideNotClickableItems = event.getConstant("HideNotClickableItems") ?: return
hideNpcSellFilter.load(hideNotClickableItems["hide_npc_sell"].asJsonObject)
hideInStorageFilter.load(hideNotClickableItems["hide_in_storage"].asJsonObject)
- tradeNpcFilter.load(event.getConstant("TradeNpcs")!!)
updateSalvageList(hideNotClickableItems)
hidePlayerTradeFilter.load(hideNotClickableItems["hide_player_trade"].asJsonObject)
notAuctionableFilter.load(hideNotClickableItems["not_auctionable"].asJsonObject)
} catch (e: Exception) {
e.printStackTrace()
- LorenzUtils.error("error in RepositoryReloadEvent")
+ LorenzUtils.error("Error in RepositoryReloadEvent for HideNotClickableItems")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
index 845262e91..8608c8f16 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
@@ -40,7 +40,7 @@ class ItemStars {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
try {
- val items = event.getConstant("Items")!!
+ val items = event.getConstant("Items") ?: return
if (items.has("crimson_armors")) {
armorNames.clear()
armorNames.addAll(items.getAsJsonArray("crimson_armors").map { it.asString })
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
index 491c310b7..012570add 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
@@ -25,7 +25,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
val miniBossHelper = DailyMiniBossHelper(this)
val kuudraBossHelper = DailyKuudraBossHelper(this)
- var repoData: JsonObject = JsonObject()
+ var repoData: JsonObject? = null
var factionType = FactionType.NONE
private var display = emptyList<List<Any>>()
@@ -39,7 +39,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
- repoData = event.getConstant("CrimsonIsleReputation")!!
+ repoData = event.getConstant("CrimsonIsleReputation") ?: return
tryLoadConfig()
update()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
index 289380a81..597de55e4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
@@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
-import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -104,7 +103,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH
kuudraTiers.clear()
//Repo
- val repoData = reputationHelper.repoData
+ val repoData = reputationHelper.repoData ?: return
val jsonElement = repoData["KUUDRA"]
var tier = 1
for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt
index 2596ef124..394f92383 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt
@@ -77,7 +77,8 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) {
}
}
- for (entry in dailyQuestHelper.reputationHelper.repoData.entrySet()) {
+ val repoData = dailyQuestHelper.reputationHelper.repoData ?: return UnknownQuest(name)
+ for (entry in repoData.entrySet()) {
val categoryName = entry.key
val category = entry.value.asJsonObject
for ((entryName, extraData) in category.entrySet()) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
index 63983f102..ad9032d43 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
@@ -113,7 +113,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
miniBosses.clear()
//Repo
- val repoData = reputationHelper.repoData
+ val repoData = reputationHelper.repoData ?: return
val jsonElement = repoData["MINIBOSS"]
for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
val data = extraData.asJsonObject