From f5df6a02981ce00a1525e4e19183727a2d9f222f Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 27 Jan 2021 18:42:34 -0500 Subject: [PATCH] menu manager: preserve managed menu option ordering Also add a check that the menu being added is of type CC_OP so that we know getWidgetId() is valid --- .../main/java/net/runelite/client/menus/MenuManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java index a597038628..179b757001 100644 --- a/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java +++ b/runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java @@ -26,7 +26,7 @@ package net.runelite.client.menus; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; import java.util.Arrays; import java.util.Collection; @@ -66,7 +66,7 @@ public class MenuManager //Maps the indexes that are being used to the menu option. private final Map playerMenuIndexMap = new HashMap<>(); //Used to manage custom non-player menu options - private final Multimap managedMenuOptions = HashMultimap.create(); + private final Multimap managedMenuOptions = LinkedHashMultimap.create(); private final Set npcMenuOptions = new HashSet<>(); @Inject @@ -117,7 +117,7 @@ public class MenuManager @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { - if (client.getSpellSelected()) + if (client.getSpellSelected() || event.getType() != MenuAction.CC_OP.getId()) { return; }