aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2024-03-03 17:33:56 +0100
committerGitHub <noreply@github.com>2024-03-03 17:33:56 +0100
commitcceb8df8f5a1da3caff4624838515c6607867220 (patch)
tree1035bbc8d7fd65e328975ef507c046c4711f363a /src/main/java/io
parentd20d4a4a1258f41c6a18e63222bb8c5a20acd8c5 (diff)
downloadNotEnoughUpdates-cceb8df8f5a1da3caff4624838515c6607867220.tar.gz
NotEnoughUpdates-cceb8df8f5a1da3caff4624838515c6607867220.tar.bz2
NotEnoughUpdates-cceb8df8f5a1da3caff4624838515c6607867220.zip
Hopefully fixed mayor npe if you cant connect to the election api (#1033)
* Hopefully fixed mayor npe if you cant connect to the election api * Remove null check
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index 1cb015c5..82c9b3b6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -20,7 +20,6 @@
package io.github.moulberry.notenoughupdates.listener;
import com.google.common.collect.Lists;
-import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUApi;
import io.github.moulberry.notenoughupdates.NEUOverlay;
@@ -96,6 +95,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -749,7 +749,7 @@ public class RenderListener {
valueStringBIN1 = EnumChatFormatting.YELLOW + "Value (BIN): ";
valueStringBIN2 = EnumChatFormatting.GOLD + formatCoins(totalValue) + " coins";
} else {
- valueStringBIN1 = EnumChatFormatting.YELLOW + "Can't find BIN: ";
+ valueStringBIN1 = EnumChatFormatting.YELLOW + "Can't find Price: ";
valueStringBIN2 = missingItem;
}
@@ -834,11 +834,12 @@ public class RenderListener {
160
);
}
- JsonObject mayorJson = SBInfo.getInstance().getMayorJson();
- JsonElement mayor = mayorJson.get("mayor");
- if (mayorJson.has("mayor") && mayor != null && mayor.getAsJsonObject().has("name") &&
- mayor.getAsJsonObject().get("name").getAsString().equals("Derpy")
- && NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
+ String mayorJson = Utils.getElementAsString(
+ Utils.getElement(SBInfo.getInstance().getMayorJson(), "mayor.name"),
+ ""
+ );
+ if (Objects.equals(mayorJson, "Derpy") &&
+ NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
Utils.drawStringScaled(
EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Mayor Derpy active!",
guiLeft + xSize + 4 + 10,