Skip to content

Commit

Permalink
remove null check
Browse files Browse the repository at this point in the history
  • Loading branch information
rdutta committed May 30, 2024
1 parent 2dca302 commit 4e32a1f
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.InventoryID;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.Varbits;
Expand Down Expand Up @@ -68,21 +67,14 @@ private void onMenuOptionClicked(final MenuOptionClicked event)
return;
}

final ItemContainer eq = client.getItemContainer(InventoryID.EQUIPMENT);
final ItemContainer inv = client.getItemContainer(InventoryID.INVENTORY);

if (eq == null || inv == null)
{
return;
}

final boolean wearingPhalanx = InventoryUtil.containsAny(eq, CURSED_PHALANX_ITEM_IDS);
final boolean carryingPhalanx = InventoryUtil.containsAny(inv, CURSED_PHALANX_ITEM_IDS);
boolean wearingPhalanx = InventoryUtil.containsAny(client.getItemContainer(InventoryID.EQUIPMENT), CURSED_PHALANX_ITEM_IDS);
boolean carryingPhalanx = InventoryUtil.containsAny(client.getItemContainer(InventoryID.INVENTORY), CURSED_PHALANX_ITEM_IDS);

if (wearingPhalanx || carryingPhalanx)
{
event.consume();
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Remove and/or drop cursed phalanx before doing that.", null);
return;
}
}
}

0 comments on commit 4e32a1f

Please sign in to comment.