diff options
| author | efefury <69400149+efefury@users.noreply.github.com> | 2022-07-10 16:04:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-11 00:04:00 +1000 |
| commit | 04d6f54c067a5cdab61186eb37f67fef11affa57 (patch) | |
| tree | 7fac9ce78eab682d64d4d0b69787636895247ee1 /src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java | |
| parent | 6e40cd5d2426eee681b091acc6e0822d4d7c45b5 (diff) | |
| download | notenoughupdates-04d6f54c067a5cdab61186eb37f67fef11affa57.tar.gz notenoughupdates-04d6f54c067a5cdab61186eb37f67fef11affa57.tar.bz2 notenoughupdates-04d6f54c067a5cdab61186eb37f67fef11affa57.zip | |
ah profit cool gui display (#178)
Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Co-authored-by: nopo <noahogno@gmail.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java index 158f9917..80027aff 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -249,9 +249,21 @@ public class XPInformation { } public double getPetLevel(String petId, double exp, String rarity) { + if (Constants.PETS == null || !Constants.PETS.has("pet_levels")) { + Utils.showOutdatedRepoNotification(); + return 0; + } Stream<JsonElement> pet_levels = StreamSupport.stream(Constants.PETS.get("pet_levels").getAsJsonArray().spliterator(), false); + if (!Constants.PETS.has("pet_rarity_offset")) { + Utils.showOutdatedRepoNotification(); + return 0; + } int pet_rarity_offset = Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity).getAsInt(); + if (!Constants.PETS.has("custom_pet_leveling")) { + Utils.showOutdatedRepoNotification(); + return 0; + } JsonObject custom_pet_leveling = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petId); List<Integer> xpLevelsRequired = pet_levels.skip(pet_rarity_offset).limit(100).map(JsonElement::getAsInt).collect(Collectors.toList()); |
