api: add player accessor to menuentry

This commit is contained in:
Adam
2022-05-23 17:42:14 -04:00
parent 7a1d958ee0
commit 5367d225bf
6 changed files with 36 additions and 9 deletions

View File

@@ -185,9 +185,7 @@ public class HiscorePlugin extends Plugin
{
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER && event.getMenuOption().equals(LOOKUP))
{
// The player id is included in the event, so we can use that to get the player name,
// which avoids having to parse out the combat level and any icons preceding the name.
Player player = client.getCachedPlayers()[event.getId()];
Player player = event.getMenuEntry().getPlayer();
if (player == null)
{
return;

View File

@@ -713,7 +713,6 @@ public class MenuEntrySwapperPlugin extends Plugin
{
final MenuEntry entry = entries[idx];
final MenuAction type = entry.getType();
final int id = entry.getIdentifier();
if (type == MenuAction.EXAMINE_NPC)
{