aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2023-12-26 10:25:52 +0100
committerGitHub <noreply@github.com>2023-12-26 10:25:52 +0100
commit5935206fd2a20eb8d9d17e68ca4e5d5c754f6bd0 (patch)
treeed43cc50531ea55e3e2df695d0d8b4e6618db6ed
parentda1bdcbff8f8137706bf16ca9eb5b747028c1d22 (diff)
downloadNotEnoughUpdates-5935206fd2a20eb8d9d17e68ca4e5d5c754f6bd0.tar.gz
NotEnoughUpdates-5935206fd2a20eb8d9d17e68ca4e5d5c754f6bd0.tar.bz2
NotEnoughUpdates-5935206fd2a20eb8d9d17e68ca4e5d5c754f6bd0.zip
Added null check for bestiary and moved the files (#982)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java2
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt (renamed from src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryData.kt)10
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryPage.kt (renamed from src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.kt)8
4 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index 824e1995..21bdfa43 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -23,7 +23,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryPage;
+import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryPage;
import io.github.moulberry.notenoughupdates.profileviewer.rift.RiftPage;
import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishPage;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
index aac33cfa..f5e22e0a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java
@@ -26,7 +26,7 @@ import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
-import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryData;
+import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryData;
import io.github.moulberry.notenoughupdates.profileviewer.weight.senither.SenitherWeight;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight;
import io.github.moulberry.notenoughupdates.util.Constants;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryData.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
index a548678e..69688fcc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryData.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
@@ -17,7 +17,7 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.profileviewer.bestiary
+package io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary
import com.google.gson.JsonObject
import io.github.moulberry.notenoughupdates.util.Constants
@@ -128,8 +128,12 @@ object BestiaryData {
}
for (categoryId in categoriesToParse) {
- val categoryData = Constants.BESTIARY.getAsJsonObject(categoryId)!!
- parsedCategories.add(parseCategory(categoryData, categoryId, killsMap, deathsMap))
+ val categoryData = Constants.BESTIARY.getAsJsonObject(categoryId)
+ if (categoryData != null) {
+ parsedCategories.add(parseCategory(categoryData, categoryId, killsMap, deathsMap))
+ } else {
+ Utils.showOutdatedRepoNotification("bestiary.json missing or outdated")
+ }
}
return parsedCategories
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryPage.kt
index c25cbe34..d2dfe910 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryPage.kt
@@ -16,14 +16,14 @@
* You should have received a copy of the GNU Lesser General Public License
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.profileviewer.bestiary
+package io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary
import io.github.moulberry.notenoughupdates.core.util.StringUtils
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewerPage
-import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryData.calculateTotalBestiaryTiers
-import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryData.hasMigrated
-import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryData.parseBestiaryData
+import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryData.calculateTotalBestiaryTiers
+import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryData.hasMigrated
+import io.github.moulberry.notenoughupdates.miscfeatures.profileviewer.bestiary.BestiaryData.parseBestiaryData
import io.github.moulberry.notenoughupdates.util.Constants
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft