diff options
author | Cow <cow@volloeko.de> | 2023-07-16 12:08:10 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-16 12:08:10 +0200 |
commit | 24c9e641a1dc0c109d94504ef707a10171b837c4 (patch) | |
tree | add8049a1cb0f2e81fca4d0b1a8d50eb8f0e8992 /src | |
parent | f30851154f185fba3ce8877fa2ee17894844003d (diff) | |
download | Cowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.tar.gz Cowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.tar.bz2 Cowlection-24c9e641a1dc0c109d94504ef707a10171b837c4.zip |
Fixed rare crash caused by unexpected NBT data typing
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java index 21fa20d..f1d9108 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java @@ -207,11 +207,13 @@ public class SkyBlockListener { if ((MooConfig.getTooltipPetExpDisplay() == MooConfig.Setting.ALWAYS || MooConfig.getTooltipPetExpDisplay() == MooConfig.Setting.SPECIAL && MooConfig.isTooltipToggleKeyBindingPressed()) && e.itemStack.getItem() == Items.skull) { - if (extraAttributes != null && extraAttributes.hasKey("petInfo")) { + if (extraAttributes != null && extraAttributes.hasKey("petInfo", (byte) 8 /* string */)) { // pet in inventory, auction house or similar HySkyBlockStats.Profile.Pet petInfo = GsonUtils.fromJson(extraAttributes.getString("petInfo"), HySkyBlockStats.Profile.Pet.class); - int index = Math.max(0, e.toolTip.size() - (e.showAdvancedItemTooltips ? /* item name & nbt info */ 2 : 0)); - e.toolTip.add(index, EnumChatFormatting.GRAY + "Pet exp: " + EnumChatFormatting.GOLD + numberFormatter.format(petInfo.getExp())); + if (petInfo != null) { + int index = Math.max(0, e.toolTip.size() - (e.showAdvancedItemTooltips ? /* item name & nbt info */ 2 : 0)); + e.toolTip.add(index, EnumChatFormatting.GRAY + "Pet exp: " + EnumChatFormatting.GOLD + numberFormatter.format(petInfo.getExp())); + } } else if (e.itemStack.getDisplayName().contains("[Lvl ")) { // pet in pets menu for (int i = e.toolTip.size() - 1; i >= 0; i--) { |