diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-07-05 11:57:35 +0800 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-07-05 11:57:35 +0800 |
commit | 4f2c5699c278f5f7a9b29aebbab4052f2b9c59e5 (patch) | |
tree | 0bd32291dd046a1b1f0c476a606ccaa2dd48c749 /src/main/java/de/hysky/skyblocker | |
parent | 6863c696e9ce34854aabdf0a4e2883e7ea8be0a8 (diff) | |
download | Skyblocker-4f2c5699c278f5f7a9b29aebbab4052f2b9c59e5.tar.gz Skyblocker-4f2c5699c278f5f7a9b29aebbab4052f2b9c59e5.tar.bz2 Skyblocker-4f2c5699c278f5f7a9b29aebbab4052f2b9c59e5.zip |
Fix DisciplineTestHelper heldId NPE
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DisciplineTestHelper.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DisciplineTestHelper.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DisciplineTestHelper.java index c01bfd73..ab0a0781 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DisciplineTestHelper.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DisciplineTestHelper.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.client.MinecraftClient; import java.util.Map; +import java.util.Objects; public class DisciplineTestHelper { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); @@ -41,11 +42,10 @@ public class DisciplineTestHelper { return false; } String heldId = CLIENT.player.getMainHandStack().getSkyblockId(); - if (SWORD_TO_NAME_LOOKUP.containsKey(heldId)) { - - return SWORD_TO_NAME_LOOKUP.get(heldId).equals(name); + if (heldId == null) { + return false; } - return false; + return Objects.equals(SWORD_TO_NAME_LOOKUP.get(heldId), name); } /** @@ -58,6 +58,9 @@ public class DisciplineTestHelper { return 0; } String heldId = CLIENT.player.getMainHandStack().getSkyblockId(); + if (heldId == null) { + return 0; + } return SWORD_TO_COLOR_LOOKUP.getOrDefault(heldId, 0); } } |