diff options
author | syeyoung <cyoung06@naver.com> | 2021-10-13 23:02:53 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-10-13 23:02:53 +0900 |
commit | f3248605aac0973e144d52c6b9dc7742d7e1f358 (patch) | |
tree | caa8c00cc43a0560d42675d409340f4fcd8cd23c /src/main/java/kr/syeyoung/dungeonsguide/features/impl | |
parent | 5f8e3c60dc037e9ebd0289d7ae4d2a3f9bcd0bd9 (diff) | |
download | Skyblock-Dungeons-Guide-f3248605aac0973e144d52c6b9dc7742d7e1f358.tar.gz Skyblock-Dungeons-Guide-f3248605aac0973e144d52c6b9dc7742d7e1f358.tar.bz2 Skyblock-Dungeons-Guide-f3248605aac0973e144d52c6b9dc7742d7e1f358.zip |
- Fix Talisman/Weight renderer throwing error
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl')
2 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java index a97ebae3..fa9ecf65 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java @@ -33,7 +33,10 @@ public class DataRendererLilyWeight implements DataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eLily Weight §b"+String.format("%.3f", playerProfile.getLilyWeight().getTotal()), 0,0,-1); + if (playerProfile.getLilyWeight() == null) + fr.drawString("§eLily Weight §cAPI DISABLED", 0,0,-1); + else + fr.drawString("§eLily Weight §b"+String.format("%.3f", playerProfile.getLilyWeight().getTotal()), 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } @@ -51,6 +54,7 @@ public class DataRendererLilyWeight implements DataRenderer { @Override public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { PlayerProfile.LilyWeight lilyWeight= playerProfile.getLilyWeight(); + if (lilyWeight == null) return; ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GuiUtils.drawHoveringText(Arrays.asList( "§bDungeon Weights§7: §e"+ String.format("%.3f",lilyWeight.getCatacombs_base()+lilyWeight.getCatacombs_master()+lilyWeight.getCatacombs_exp()), diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java index 2112362f..db17322d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java @@ -37,7 +37,8 @@ import java.util.List; public class DataRendererTalismans implements DataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { - if (!playerProfile.getAdditionalProperties().containsKey("talismanCnt")) { + boolean apiDisabled = playerProfile.getTalismans() == null || playerProfile.getInventory() == null; + if (!playerProfile.getAdditionalProperties().containsKey("talismanCnt") && !apiDisabled) { int[] cnts = new int[Rarity.values().length]; for (ItemStack talisman : playerProfile.getTalismans()) { if (talisman == null) continue; @@ -58,6 +59,9 @@ public class DataRendererTalismans implements DataRenderer { } FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (apiDisabled) + fr.drawString("§eTalis §cAPI DISABLED", 0,0,-1); + else fr.drawString("§eTalis §f"+str, 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } |