api/client: various (MenuEntry api stuff, agility/translate plugin stuff to use that) (#1748)
* Standardize MenuEntry methods, make MenuEntry events extend MenuEntry * Make agility plugin only change entries it needs to * Clean up chat translator by a lot, also implement cloneable instead of just adding a ranodm copy method smh * actions: allow slash in PR title * devtools: Fix checkstyle * examineplugin: Fix tests
This commit is contained in:
@@ -247,14 +247,14 @@ public class MenuManager
|
||||
{
|
||||
for (AbstractComparableEntry e : hiddenEntries)
|
||||
{
|
||||
if (e.matches(event.getMenuEntry()))
|
||||
if (e.matches(event))
|
||||
{
|
||||
client.setMenuOptionCount(client.getMenuOptionCount() - 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int widgetId = event.getActionParam1();
|
||||
int widgetId = event.getParam1();
|
||||
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
|
||||
|
||||
for (WidgetMenuOption currentMenu : options)
|
||||
@@ -443,7 +443,7 @@ public class MenuManager
|
||||
return; // not a player menu
|
||||
}
|
||||
|
||||
int widgetId = event.getActionParam1();
|
||||
int widgetId = event.getParam1();
|
||||
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
|
||||
|
||||
for (WidgetMenuOption curMenuOption : options)
|
||||
|
||||
@@ -40,8 +40,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
import static net.runelite.api.Skill.AGILITY;
|
||||
@@ -49,6 +49,7 @@ import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.BeforeRender;
|
||||
import net.runelite.api.events.BoostedLevelChanged;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.DecorativeObjectChanged;
|
||||
@@ -65,7 +66,7 @@ import net.runelite.api.events.GroundObjectDespawned;
|
||||
import net.runelite.api.events.GroundObjectSpawned;
|
||||
import net.runelite.api.events.ItemDespawned;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.api.events.WallObjectChanged;
|
||||
import net.runelite.api.events.WallObjectDespawned;
|
||||
import net.runelite.api.events.WallObjectSpawned;
|
||||
@@ -90,6 +91,7 @@ import net.runelite.client.util.ColorUtil;
|
||||
public class AgilityPlugin extends Plugin
|
||||
{
|
||||
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
||||
private static final Object MENU_SUBS = new Object();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<TileObject, Obstacle> obstacles = new HashMap<>();
|
||||
@@ -164,7 +166,6 @@ public class AgilityPlugin extends Plugin
|
||||
private Color trapColor;
|
||||
private boolean notifyAgilityArena;
|
||||
private boolean showAgilityArenaTimer;
|
||||
private boolean showShortcutLevel;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@@ -172,6 +173,11 @@ public class AgilityPlugin extends Plugin
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
if (config.showShortcutLevel())
|
||||
{
|
||||
addMenuSubscriptions();
|
||||
}
|
||||
|
||||
overlayManager.add(agilityOverlay);
|
||||
overlayManager.add(lapCounterOverlay);
|
||||
agilityLevel = client.getBoostedSkillLevel(Skill.AGILITY);
|
||||
@@ -181,6 +187,7 @@ public class AgilityPlugin extends Plugin
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
eventBus.unregister(MENU_SUBS);
|
||||
|
||||
overlayManager.remove(agilityOverlay);
|
||||
overlayManager.remove(lapCounterOverlay);
|
||||
@@ -211,7 +218,12 @@ public class AgilityPlugin extends Plugin
|
||||
eventBus.subscribe(DecorativeObjectSpawned.class, this, this::onDecorativeObjectSpawned);
|
||||
eventBus.subscribe(DecorativeObjectChanged.class, this, this::onDecorativeObjectChanged);
|
||||
eventBus.subscribe(DecorativeObjectDespawned.class, this, this::onDecorativeObjectDespawned);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
}
|
||||
|
||||
private void addMenuSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender);
|
||||
eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened);
|
||||
}
|
||||
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
@@ -245,6 +257,19 @@ public class AgilityPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if ("addLevelsToShortcutOptions".equals(event.getKey()))
|
||||
{
|
||||
if (config.showShortcutLevel())
|
||||
{
|
||||
addMenuSubscriptions();
|
||||
}
|
||||
else
|
||||
{
|
||||
eventBus.unregister(MENU_SUBS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
|
||||
if (!this.showAgilityArenaTimer)
|
||||
@@ -268,7 +293,6 @@ public class AgilityPlugin extends Plugin
|
||||
this.trapColor = config.getTrapColor();
|
||||
this.notifyAgilityArena = config.notifyAgilityArena();
|
||||
this.showAgilityArenaTimer = config.showAgilityArenaTimer();
|
||||
this.showShortcutLevel = config.showShortcutLevel();
|
||||
}
|
||||
|
||||
private void onExperienceChanged(ExperienceChanged event)
|
||||
@@ -495,32 +519,52 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
private void onBeforeRender(BeforeRender event)
|
||||
{
|
||||
if (!this.showShortcutLevel)
|
||||
if (client.isMenuOpen() || client.getMenuOptionCount() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Guarding against non-first option because agility shortcuts are always that type of event.
|
||||
if (event.getType() != MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId())
|
||||
final MenuEntry entry = client.getLeftClickMenuEntry();
|
||||
if (checkAndModify(entry))
|
||||
{
|
||||
return;
|
||||
client.setLeftClickMenuEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuOpened(MenuOpened event)
|
||||
{
|
||||
boolean changed = false;
|
||||
for (MenuEntry entry : event.getMenuEntries())
|
||||
{
|
||||
changed |= checkAndModify(entry);
|
||||
}
|
||||
|
||||
event.setModified(changed);
|
||||
}
|
||||
|
||||
private boolean checkAndModify(MenuEntry old)
|
||||
{
|
||||
//Guarding against non-first option because agility shortcuts are always that type of event.
|
||||
if (old.getOpcode() != MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Obstacle nearbyObstacle : getObstacles().values())
|
||||
{
|
||||
AgilityShortcut shortcut = nearbyObstacle.getShortcut();
|
||||
if (shortcut != null && Ints.contains(shortcut.getObstacleIds(), event.getIdentifier()))
|
||||
if (shortcut != null && Ints.contains(shortcut.getObstacleIds(), old.getIdentifier()))
|
||||
{
|
||||
final MenuEntry entry = event.getMenuEntry();
|
||||
final int reqLevel = shortcut.getLevel();
|
||||
final String requirementText = ColorUtil.getLevelColorString(reqLevel, getAgilityLevel()) + " (level-" + reqLevel + ")";
|
||||
|
||||
entry.setTarget(event.getTarget() + requirementText);
|
||||
event.setWasModified(true);
|
||||
return;
|
||||
old.setTarget(old.getTarget() + requirementText);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,11 +314,11 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getOption().equals("Examine"))
|
||||
{
|
||||
Widget container = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
|
||||
Widget item = container.getChild(event.getActionParam0());
|
||||
Widget item = container.getChild(event.getParam0());
|
||||
int itemID = item.getItemId();
|
||||
String text = EDIT_TAGS_MENU_OPTION;
|
||||
int tagCount = tagManager.getTags(itemID, false).size() + tagManager.getTags(itemID, true).size();
|
||||
@@ -333,8 +333,8 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
event.getTarget(),
|
||||
MenuOpcode.RUNELITE.getId(),
|
||||
event.getIdentifier(),
|
||||
event.getActionParam0(),
|
||||
event.getActionParam1(),
|
||||
event.getParam0(),
|
||||
event.getParam1(),
|
||||
false
|
||||
);
|
||||
}
|
||||
@@ -344,12 +344,12 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getMenuOpcode() == MenuOpcode.RUNELITE
|
||||
&& event.getOption().startsWith(EDIT_TAGS_MENU_OPTION))
|
||||
{
|
||||
event.consume();
|
||||
int inventoryIndex = event.getActionParam0();
|
||||
int inventoryIndex = event.getParam0();
|
||||
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
|
||||
if (bankContainer == null)
|
||||
{
|
||||
|
||||
@@ -536,12 +536,12 @@ public class TabInterface
|
||||
}
|
||||
|
||||
if (activeTab != null
|
||||
&& event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getOption().equals("Examine"))
|
||||
{
|
||||
insertMenuEntry(event, REMOVE_TAG + " (" + activeTab.getTag() + ")", event.getTarget());
|
||||
}
|
||||
else if (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()
|
||||
else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()
|
||||
&& event.getOption().equals("Deposit inventory"))
|
||||
{
|
||||
insertMenuEntry(event, TAG_INVENTORY, event.getTarget());
|
||||
@@ -551,7 +551,7 @@ public class TabInterface
|
||||
insertMenuEntry(event, TAG_INVENTORY, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR));
|
||||
}
|
||||
}
|
||||
else if (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId()
|
||||
else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId()
|
||||
&& event.getOption().equals("Deposit worn items"))
|
||||
{
|
||||
insertMenuEntry(event, TAG_GEAR, event.getTarget());
|
||||
@@ -591,7 +591,7 @@ public class TabInterface
|
||||
{
|
||||
if (event.getOption().startsWith(CHANGE_ICON + " ("))
|
||||
{
|
||||
ItemDefinition item = getItem(event.getActionParam0());
|
||||
ItemDefinition item = getItem(event.getParam0());
|
||||
if (item != null)
|
||||
{
|
||||
int itemId = itemManager.canonicalize(item.getId());
|
||||
@@ -622,13 +622,13 @@ public class TabInterface
|
||||
activateTab(null);
|
||||
}
|
||||
else if (activeTab != null
|
||||
&& event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
&& event.getMenuOpcode() == MenuOpcode.RUNELITE
|
||||
&& event.getOption().startsWith(REMOVE_TAG))
|
||||
{
|
||||
// Add "remove" menu entry to all items in bank while tab is selected
|
||||
event.consume();
|
||||
final ItemDefinition item = getItem(event.getActionParam0());
|
||||
final ItemDefinition item = getItem(event.getParam0());
|
||||
final int itemId;
|
||||
if (item != null)
|
||||
{
|
||||
@@ -638,10 +638,10 @@ public class TabInterface
|
||||
}
|
||||
}
|
||||
else if (event.getMenuOpcode() == MenuOpcode.RUNELITE
|
||||
&& ((event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() && event.getOption().equals(TAG_INVENTORY))
|
||||
|| (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() && event.getOption().equals(TAG_GEAR))))
|
||||
&& ((event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() && event.getOption().equals(TAG_INVENTORY))
|
||||
|| (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() && event.getOption().equals(TAG_GEAR))))
|
||||
{
|
||||
handleDeposit(event, event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId());
|
||||
handleDeposit(event, event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,8 +1057,8 @@ public class TabInterface
|
||||
target,
|
||||
MenuOpcode.RUNELITE.getId(),
|
||||
event.getIdentifier(),
|
||||
event.getActionParam0(),
|
||||
event.getActionParam1(),
|
||||
event.getParam0(),
|
||||
event.getParam1(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ public interface ChatTranslationConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "translateOptionVisable",
|
||||
keyName = "translateOptionVisible",
|
||||
name = "Show 'Translate' menu option",
|
||||
description = "Adds 'Translate' to the right-click menu in the Chatbox.",
|
||||
position = 1,
|
||||
titleSection = "chatTranslation"
|
||||
)
|
||||
default boolean translateOptionVisable()
|
||||
default boolean translateOptionVisible()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public interface ChatTranslationConfig extends Config
|
||||
position = 2,
|
||||
titleSection = "chatTranslation",
|
||||
hidden = true,
|
||||
unhide = "translateOptionVisable"
|
||||
unhide = "translateOptionVisible"
|
||||
)
|
||||
default boolean publicChat()
|
||||
{
|
||||
@@ -53,17 +53,25 @@ public interface ChatTranslationConfig extends Config
|
||||
position = 3,
|
||||
titleSection = "chatTranslation",
|
||||
hidden = true,
|
||||
unhide = "translateOptionVisable"
|
||||
unhide = "translateOptionVisible"
|
||||
)
|
||||
default String getPlayerNames()
|
||||
default String playerNames()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "playerNames",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
void playerNames(String names);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "publicTargetLanguage",
|
||||
name = "Target Language",
|
||||
description = "Language to translate messages to.",
|
||||
description = "Language to translate others' messages to.",
|
||||
position = 4,
|
||||
titleSection = "chatTranslation",
|
||||
hidden = true,
|
||||
@@ -100,7 +108,7 @@ public interface ChatTranslationConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "playerTargetLanguage",
|
||||
name = "Target Language",
|
||||
description = "Language to translate messages to.",
|
||||
description = "Language to translate your messages to.",
|
||||
position = 7,
|
||||
titleSection = "playerMessageTranslation",
|
||||
hidden = true,
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
package net.runelite.client.plugins.chattranslation;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.MessageNode;
|
||||
import static net.runelite.api.ScriptID.CHATBOX_INPUT;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.PlayerMenuOptionClicked;
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
@@ -34,7 +33,6 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.api.util.Text;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Chat Translator",
|
||||
@@ -46,11 +44,14 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
@Slf4j
|
||||
public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
|
||||
private static final Object PUBLIC = new Object();
|
||||
private static final Object OPTION = new Object();
|
||||
private static final String TRANSLATE = "Translate";
|
||||
|
||||
// TODO: Find out if "Remove friend" is correct here, aka if clan tab should have the Translate option
|
||||
private static final ImmutableList<String> AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick");
|
||||
|
||||
private final Translator translator = new Translator();
|
||||
private final Set<String> playerNames = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
@@ -60,10 +61,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private Provider<MenuManager> menuManager;
|
||||
private MenuManager menuManager;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
@@ -77,13 +75,6 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private boolean translateOptionVisable;
|
||||
private boolean publicChat;
|
||||
private String getPlayerNames;
|
||||
private Languages publicTargetLanguage;
|
||||
private boolean playerChat;
|
||||
private Languages playerTargetLanguage;
|
||||
|
||||
@Provides
|
||||
ChatTranslationConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -93,104 +84,149 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
|
||||
if (client != null && this.translateOptionVisable)
|
||||
translator.setInLang(config.publicTargetLanguage());
|
||||
translator.setOutLang(config.playerTargetLanguage());
|
||||
|
||||
if (config.playerChat())
|
||||
{
|
||||
menuManager.get().addPlayerMenuItem(TRANSLATE);
|
||||
keyManager.registerKeyListener(this);
|
||||
}
|
||||
keyManager.registerKeyListener(this);
|
||||
|
||||
playerNames.addAll(Text.fromCSV(config.getPlayerNames()));
|
||||
if (config.publicChat())
|
||||
{
|
||||
eventBus.subscribe(ChatMessage.class, PUBLIC, this::onChatMessage);
|
||||
}
|
||||
|
||||
if (config.translateOptionVisible())
|
||||
{
|
||||
menuManager.addPlayerMenuItem(TRANSLATE);
|
||||
eventBus.subscribe(MenuOpened.class, OPTION, this::onMenuOpened);
|
||||
eventBus.subscribe(MenuOptionClicked.class, OPTION, this::onMenuOptionClicked);
|
||||
}
|
||||
|
||||
for (String name : Text.fromCSV(config.playerNames().toLowerCase()))
|
||||
{
|
||||
playerNames.add(Text.toJagexName(name));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
if (client != null && this.translateOptionVisable)
|
||||
{
|
||||
menuManager.get().removePlayerMenuItem(TRANSLATE);
|
||||
}
|
||||
eventBus.unregister(OPTION);
|
||||
eventBus.unregister(PUBLIC);
|
||||
menuManager.removePlayerMenuItem(TRANSLATE);
|
||||
keyManager.unregisterKeyListener(this);
|
||||
|
||||
playerNames.clear();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked);
|
||||
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
|
||||
}
|
||||
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("chattranslation"))
|
||||
{
|
||||
updateConfig();
|
||||
if (event.getKey().equals("playerNames"))
|
||||
{
|
||||
for (String names : Text.fromCSV(this.getPlayerNames))
|
||||
{
|
||||
if (!playerNames.contains(Text.toJagexName(names)))
|
||||
{
|
||||
playerNames.add(Text.toJagexName(names));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!this.translateOptionVisable)
|
||||
if (!event.getGroup().equals("chattranslation"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
String option = event.getOption();
|
||||
|
||||
if (groupId == WidgetInfo.CHATBOX.getGroupId())
|
||||
switch (event.getKey())
|
||||
{
|
||||
if (!AFTER_OPTIONS.contains(option))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final MenuEntry menuEntry = new MenuEntry();
|
||||
menuEntry.setOption(TRANSLATE);
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
menuEntry.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
menuEntry.setParam0(event.getActionParam0());
|
||||
menuEntry.setParam1(event.getActionParam1());
|
||||
menuEntry.setIdentifier(event.getIdentifier());
|
||||
|
||||
MenuEntry[] newMenu = ObjectArrays.concat(menuEntry, client.getMenuEntries());
|
||||
int menuEntryCount = newMenu.length;
|
||||
ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2);
|
||||
client.setMenuEntries(newMenu);
|
||||
case "translateOptionVisible":
|
||||
if (config.translateOptionVisible())
|
||||
{
|
||||
menuManager.addPlayerMenuItem(TRANSLATE);
|
||||
eventBus.subscribe(MenuOpened.class, TRANSLATE, this::onMenuOpened);
|
||||
eventBus.subscribe(MenuOptionClicked.class, TRANSLATE, this::onMenuOptionClicked);
|
||||
}
|
||||
else
|
||||
{
|
||||
menuManager.removePlayerMenuItem(TRANSLATE);
|
||||
eventBus.unregister(TRANSLATE);
|
||||
}
|
||||
break;
|
||||
case "publicChat":
|
||||
if (config.publicChat())
|
||||
{
|
||||
eventBus.subscribe(ChatMessage.class, PUBLIC, this::onChatMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventBus.unregister(PUBLIC);
|
||||
}
|
||||
break;
|
||||
case "playerNames":
|
||||
playerNames.clear();
|
||||
for (String names : Text.fromCSV(config.playerNames().toLowerCase()))
|
||||
{
|
||||
playerNames.add(Text.toJagexName(names));
|
||||
}
|
||||
break;
|
||||
case "publicTargetLanguage":
|
||||
translator.setInLang(config.publicTargetLanguage());
|
||||
break;
|
||||
case "playerChat":
|
||||
if (config.playerChat())
|
||||
{
|
||||
keyManager.registerKeyListener(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyManager.unregisterKeyListener(this);
|
||||
}
|
||||
break;
|
||||
case "playerTargetLanguage":
|
||||
translator.setOutLang(config.playerTargetLanguage());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
|
||||
private void onMenuOpened(MenuOpened event)
|
||||
{
|
||||
if (event.getMenuOption().equals(TRANSLATE))
|
||||
MenuEntry[] entries = event.getMenuEntries();
|
||||
|
||||
for (int i = 0; i < event.getMenuEntries().length; i++)
|
||||
{
|
||||
String name = Text.toJagexName(event.getMenuTarget());
|
||||
if (!playerNames.contains(name))
|
||||
if (!AFTER_OPTIONS.contains(entries[i].getOption()))
|
||||
{
|
||||
playerNames.add(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
configManager.setConfiguration("chattranslation", "playerNames", Text.toCSV(playerNames));
|
||||
configManager.sendConfig();
|
||||
MenuEntry[] newEntries = new MenuEntry[entries.length + 1];
|
||||
|
||||
System.arraycopy(entries, 0, newEntries, 0, i + 1);
|
||||
System.arraycopy(entries, i, newEntries, i + 1, entries.length - i);
|
||||
|
||||
newEntries[i] = newEntries[i].clone();
|
||||
newEntries[i].setOption(TRANSLATE);
|
||||
newEntries[i].setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
|
||||
event.setMenuEntries(newEntries);
|
||||
event.setModified(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getOpcode() != MenuOpcode.RUNELITE.getId() ||
|
||||
!event.getOption().equals(TRANSLATE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String name =
|
||||
Text.toJagexName(
|
||||
Text.removeTags(event.getTarget(), true)
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
playerNames.add(name);
|
||||
|
||||
config.playerNames(Text.toCSV(playerNames));
|
||||
}
|
||||
|
||||
private void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN)
|
||||
@@ -202,41 +238,31 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
case PUBLICCHAT:
|
||||
case MODCHAT:
|
||||
case FRIENDSCHAT:
|
||||
if (!this.publicChat)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
for (String nameList : playerNames)
|
||||
if (!playerNames.contains(Text.toJagexName(Text.removeTags(chatMessage.getName().toLowerCase()))))
|
||||
{
|
||||
if (nameList.contains(Text.toJagexName(chatMessage.getName())))
|
||||
{
|
||||
String message = chatMessage.getMessage();
|
||||
|
||||
Translator translator = new Translator();
|
||||
|
||||
try
|
||||
{
|
||||
String translation = translator.translate("auto", this.publicTargetLanguage.toShortString(), message);
|
||||
if (translation != null)
|
||||
{
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
messageNode.setRuneLiteFormatMessage(translation);
|
||||
chatMessageManager.update(messageNode);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn(e.toString());
|
||||
}
|
||||
|
||||
client.refreshChat();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = chatMessage.getMessage();
|
||||
|
||||
try
|
||||
{
|
||||
final String translation = translator.translateIncoming(message);
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
messageNode.setRuneLiteFormatMessage(translation);
|
||||
chatMessageManager.update(messageNode);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.warn("Error translating message", e);
|
||||
}
|
||||
|
||||
client.refreshChat();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,59 +273,39 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.playerChat)
|
||||
final Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
|
||||
|
||||
if (chatboxParent == null || chatboxParent.getOnKeyListener() == null || event.getKeyCode() != 0xA)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
|
||||
final String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
|
||||
final String translated;
|
||||
|
||||
if (chatboxParent != null && chatboxParent.getOnKeyListener() != null && event.getKeyCode() == 0xA)
|
||||
try
|
||||
{
|
||||
Translator translator = new Translator();
|
||||
String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
|
||||
|
||||
if (message.startsWith("/"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (config.playerTargetLanguage() == Languages.GERMAN)
|
||||
{
|
||||
// This is 'sort of' needed as German will translate the / and it will send to public-chat instead of clan-chat.
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "/" + translator.translate("auto", config.playerTargetLanguage().toShortString(), message));
|
||||
}
|
||||
else
|
||||
{
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translator.translate("auto", config.playerTargetLanguage().toShortString(), message));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn("Translation error", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
event.consume();
|
||||
|
||||
try
|
||||
{
|
||||
//Automatically check language of message and translate to selected language.
|
||||
String translation = translator.translate("auto", this.playerTargetLanguage.toShortString(), message);
|
||||
if (translation != null)
|
||||
{
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation);
|
||||
|
||||
clientThread.invoke(() ->
|
||||
client.runScript(CHATBOX_INPUT, 0, translation));
|
||||
}
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn(e.toString());
|
||||
}
|
||||
translated = translator.translateOutgoing(message);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.warn("Error translating message", e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.startsWith("/"))
|
||||
{
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translated.startsWith("/") ? translated : "/" + translated);
|
||||
return;
|
||||
}
|
||||
|
||||
event.consume();
|
||||
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translated);
|
||||
|
||||
clientThread.invoke(() -> client.runScript(CHATBOX_INPUT, 0, translated));
|
||||
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -313,14 +319,4 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
// Nothing.
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.publicChat = config.publicChat();
|
||||
this.getPlayerNames = config.getPlayerNames();
|
||||
this.translateOptionVisable = config.translateOptionVisable();
|
||||
this.publicTargetLanguage = config.publicTargetLanguage();
|
||||
this.playerChat = config.playerChat();
|
||||
this.playerTargetLanguage = config.playerTargetLanguage();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@ package net.runelite.client.plugins.chattranslation;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
// TODO: Doesn't Locale pretty much do this as well?
|
||||
public enum Languages
|
||||
{
|
||||
|
||||
ENGLISH("English", "en"),
|
||||
WELSH("Welsh", "cy"),
|
||||
DUTCH("Dutch", "nl"),
|
||||
|
||||
@@ -2,8 +2,8 @@ package net.runelite.client.plugins.chattranslation;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@@ -11,27 +11,56 @@ import java.net.URLEncoder;
|
||||
|
||||
class Translator
|
||||
{
|
||||
private static final String BASE_URL = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=";
|
||||
private static final String SOURCE = "auto";
|
||||
private static final String CENT_URL = "&tl=";
|
||||
private static final String LAST_URL = "&dt=t&q=";
|
||||
|
||||
public String translate(String source, String target, String message) throws Exception
|
||||
private String incomingUrlBase;
|
||||
private String outgoingUrlBase;
|
||||
|
||||
void setInLang(Languages lang)
|
||||
{
|
||||
incomingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL;
|
||||
}
|
||||
void setOutLang(Languages lang)
|
||||
{
|
||||
outgoingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL;
|
||||
}
|
||||
|
||||
String url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + source + "&tl=" + target + "&dt=t&q=" + URLEncoder.encode(message, "UTF-8");
|
||||
String translateIncoming(String message) throws IOException
|
||||
{
|
||||
final String url = incomingUrlBase + URLEncoder.encode(message, "UTF-8");
|
||||
return translate(new URL(url));
|
||||
}
|
||||
|
||||
URL obj = new URL(url);
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
String translateOutgoing(String message) throws IOException
|
||||
{
|
||||
final String url = outgoingUrlBase + URLEncoder.encode(message, "UTF-8");
|
||||
return translate(new URL(url));
|
||||
}
|
||||
|
||||
public String translate(URL url) throws IOException
|
||||
{
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
|
||||
{
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
return parseResult(response.toString());
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
{
|
||||
response.append(inputLine);
|
||||
}
|
||||
|
||||
return parseResult(response.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private String parseResult(String inputJson)
|
||||
|
||||
@@ -244,7 +244,7 @@ public class CorpPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getType() != NPC_SECOND_OPTION.getId()
|
||||
if (event.getOpcode() != NPC_SECOND_OPTION.getId()
|
||||
|| !this.leftClickCore || !event.getOption().equals(ATTACK))
|
||||
{
|
||||
return;
|
||||
@@ -257,8 +257,8 @@ public class CorpPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
event.getMenuEntry().setOpcode(NPC_SECOND_OPTION.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET);
|
||||
event.setWasModified(true);
|
||||
event.setOpcode(NPC_SECOND_OPTION.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET);
|
||||
event.setModified(true);
|
||||
}
|
||||
|
||||
private void onConfigChanged(ConfigChanged configChanged)
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -377,20 +376,18 @@ public class DevToolsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
private void onMenuEntryAdded(MenuEntryAdded entry)
|
||||
{
|
||||
if (!examine.isActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MenuOpcode action = MenuOpcode.of(event.getType());
|
||||
MenuOpcode action = MenuOpcode.of(entry.getOpcode());
|
||||
|
||||
if (EXAMINE_MENU_ACTIONS.contains(action))
|
||||
{
|
||||
final MenuEntry entry = event.getMenuEntry();
|
||||
|
||||
final int identifier = event.getIdentifier();
|
||||
final int identifier = entry.getIdentifier();
|
||||
String info = "ID: ";
|
||||
|
||||
if (action == MenuOpcode.EXAMINE_NPC)
|
||||
@@ -410,7 +407,7 @@ public class DevToolsPlugin extends Plugin
|
||||
}
|
||||
|
||||
entry.setTarget(entry.getTarget() + " " + ColorUtil.prependColorTag("(" + info + ")", JagexColors.MENU_TARGET));
|
||||
event.setWasModified(true);
|
||||
entry.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,18 +145,18 @@ public class ExaminePlugin extends Plugin
|
||||
type = ExamineType.ITEM;
|
||||
id = event.getIdentifier();
|
||||
|
||||
int widgetId = event.getActionParam1();
|
||||
int widgetId = event.getParam1();
|
||||
int widgetGroup = TO_GROUP(widgetId);
|
||||
int widgetChild = TO_CHILD(widgetId);
|
||||
Widget widget = client.getWidget(widgetGroup, widgetChild);
|
||||
WidgetItem widgetItem = widget.getWidgetItem(event.getActionParam0());
|
||||
WidgetItem widgetItem = widget.getWidgetItem(event.getParam0());
|
||||
quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1;
|
||||
break;
|
||||
}
|
||||
case EXAMINE_ITEM_BANK_EQ:
|
||||
{
|
||||
type = ExamineType.ITEM_BANK_EQ;
|
||||
int[] qi = findItemFromWidget(event.getActionParam1(), event.getActionParam0());
|
||||
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());
|
||||
if (qi == null)
|
||||
{
|
||||
log.debug("Examine for item with unknown widget: {}", event);
|
||||
|
||||
@@ -174,7 +174,7 @@ public class FriendNotesPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
final int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
|
||||
|
||||
// Look for "Message" on friends list
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
|
||||
@@ -189,8 +189,8 @@ public class FriendNotesPlugin extends Plugin
|
||||
event.getTarget(),
|
||||
MenuOpcode.RUNELITE.getId(),
|
||||
0,
|
||||
event.getActionParam0(),
|
||||
event.getActionParam1(),
|
||||
event.getParam0(),
|
||||
event.getParam1(),
|
||||
false
|
||||
);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class FriendNotesPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (WidgetInfo.TO_GROUP(event.getActionParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())
|
||||
if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())
|
||||
{
|
||||
if (Strings.isNullOrEmpty(event.getTarget()))
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ public class FriendTaggingPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
final int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
|
||||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
|
||||
{
|
||||
@@ -132,8 +132,8 @@ public class FriendTaggingPlugin extends Plugin
|
||||
event.getTarget(),
|
||||
MenuOpcode.RUNELITE.getId(),
|
||||
0,
|
||||
event.getActionParam0(),
|
||||
event.getActionParam1(),
|
||||
event.getParam0(),
|
||||
event.getParam1(),
|
||||
false
|
||||
);
|
||||
// Add menu entry
|
||||
@@ -173,7 +173,7 @@ public class FriendTaggingPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (WidgetInfo.TO_GROUP(event.getActionParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())
|
||||
if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId())
|
||||
{
|
||||
if (Strings.isNullOrEmpty(event.getTarget()))
|
||||
{
|
||||
|
||||
@@ -54,7 +54,6 @@ import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
import static net.runelite.api.ItemID.COINS_995;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -420,7 +419,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
private void onMenuEntryAdded(MenuEntryAdded menuEntry)
|
||||
{
|
||||
// At the moment, if the user disables quick lookup, the input listener gets disabled. Thus, isHotKeyPressed()
|
||||
// should always return false when quick lookup is disabled.
|
||||
@@ -430,7 +429,6 @@ public class GrandExchangePlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final MenuEntry menuEntry = event.getMenuEntry();
|
||||
final int widgetId = menuEntry.getParam1();
|
||||
final int groupId = WidgetInfo.TO_GROUP(widgetId);
|
||||
|
||||
@@ -448,7 +446,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
case WidgetID.SHOP_INVENTORY_GROUP_ID:
|
||||
menuEntry.setOption(SEARCH_GRAND_EXCHANGE);
|
||||
menuEntry.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
event.setWasModified(true);
|
||||
menuEntry.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -931,19 +931,19 @@ public class GroundItemsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
private void onMenuEntryAdded(MenuEntryAdded lastEntry)
|
||||
{
|
||||
if (this.itemHighlightMode != OVERLAY)
|
||||
{
|
||||
final boolean telegrabEntry = event.getOption().equals("Cast") && event.getTarget().startsWith(TELEGRAB_TEXT) && event.getType() == CAST_ON_ITEM;
|
||||
if (!(event.getOption().equals("Take") && event.getType() == THIRD_OPTION) && !telegrabEntry)
|
||||
final boolean telegrabEntry = lastEntry.getOption().equals("Cast") && lastEntry.getTarget().startsWith(TELEGRAB_TEXT) && lastEntry.getOpcode() == CAST_ON_ITEM;
|
||||
if (!(lastEntry.getOption().equals("Take") && lastEntry.getOpcode() == THIRD_OPTION) && !telegrabEntry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int itemId = event.getIdentifier();
|
||||
int itemId = lastEntry.getIdentifier();
|
||||
Scene scene = client.getScene();
|
||||
Tile tile = scene.getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
|
||||
Tile tile = scene.getTiles()[client.getPlane()][lastEntry.getParam0()][lastEntry.getParam1()];
|
||||
TileItemPile tileItemPile = tile.getItemLayer();
|
||||
|
||||
if (tileItemPile == null)
|
||||
@@ -951,8 +951,6 @@ public class GroundItemsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final MenuEntry lastEntry = event.getMenuEntry();
|
||||
|
||||
int quantity = 1;
|
||||
Node current = tileItemPile.getBottom();
|
||||
|
||||
@@ -985,7 +983,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
{
|
||||
final String optionText = telegrabEntry ? "Cast" : "Take";
|
||||
lastEntry.setOption(ColorUtil.prependColorTag(optionText, color));
|
||||
event.setWasModified(true);
|
||||
lastEntry.setModified(true);
|
||||
}
|
||||
|
||||
if (mode == BOTH || mode == NAME)
|
||||
@@ -1005,17 +1003,17 @@ public class GroundItemsPlugin extends Plugin
|
||||
}
|
||||
|
||||
lastEntry.setTarget(target);
|
||||
event.setWasModified(true);
|
||||
lastEntry.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.showMenuItemQuantities && itemComposition.isStackable() && quantity > 1)
|
||||
{
|
||||
lastEntry.setTarget(lastEntry.getTarget() + " (" + quantity + ")");
|
||||
event.setWasModified(true);
|
||||
lastEntry.setModified(true);
|
||||
}
|
||||
|
||||
if (this.removeIgnored && event.getOption().equals("Take") && hiddenItemList.contains(Text.removeTags(event.getTarget())))
|
||||
if (this.removeIgnored && lastEntry.getOption().equals("Take") && hiddenItemList.contains(Text.removeTags(lastEntry.getTarget())))
|
||||
{
|
||||
client.setMenuOptionCount(client.getMenuOptionCount() - 1);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class HiscorePlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getParam1());
|
||||
String option = event.getOption();
|
||||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId() ||
|
||||
@@ -218,8 +218,8 @@ public class HiscorePlugin extends Plugin
|
||||
lookup.setOption(LOOKUP);
|
||||
lookup.setTarget(event.getTarget());
|
||||
lookup.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
lookup.setParam0(event.getActionParam0());
|
||||
lookup.setParam1(event.getActionParam1());
|
||||
lookup.setParam0(event.getParam0());
|
||||
lookup.setParam1(event.getParam1());
|
||||
lookup.setIdentifier(event.getIdentifier());
|
||||
|
||||
if (client != null)
|
||||
|
||||
@@ -210,7 +210,7 @@ public class KourendLibraryPlugin extends Plugin
|
||||
{
|
||||
if (MenuOpcode.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuOpcode() && menuOpt.getTarget().contains("Bookshelf"))
|
||||
{
|
||||
lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getActionParam0(), menuOpt.getActionParam1(), client.getPlane());
|
||||
lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getParam0(), menuOpt.getParam1(), client.getPlane());
|
||||
overlay.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getActionParam1() != WidgetInfo.INVENTORY.getId())
|
||||
if (event.getParam1() != WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
if (this.getSwapPuro && isPuroPuro())
|
||||
{
|
||||
if (event.getType() == WALK.getId())
|
||||
if (event.getOpcode() == WALK.getId())
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1];
|
||||
@@ -627,7 +627,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
if (hintArrowNpc != null
|
||||
&& hintArrowNpc.getIndex() == eventId
|
||||
&& NPC_MENU_TYPES.contains(MenuOpcode.of(event.getType())))
|
||||
&& NPC_MENU_TYPES.contains(MenuOpcode.of(event.getOpcode())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -722,17 +722,17 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
private void onMenuOptionClicked(MenuOptionClicked entry)
|
||||
{
|
||||
if (event.getOpcode() == MenuOpcode.WIDGET_DEFAULT.getId() &&
|
||||
WidgetInfo.TO_GROUP(event.getActionParam1()) == WidgetID.JEWELLERY_BOX_GROUP_ID)
|
||||
if (entry.getOpcode() == MenuOpcode.WIDGET_DEFAULT.getId() &&
|
||||
WidgetInfo.TO_GROUP(entry.getParam1()) == WidgetID.JEWELLERY_BOX_GROUP_ID)
|
||||
{
|
||||
if (event.getOption().equals(lastDes == null ? null : lastDes.getOption()))
|
||||
if (entry.getOption().equals(lastDes == null ? null : lastDes.getOption()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JewelleryBoxDestination newDest = JewelleryBoxDestination.withOption(event.getOption());
|
||||
JewelleryBoxDestination newDest = JewelleryBoxDestination.withOption(entry.getOption());
|
||||
if (newDest == null)
|
||||
{
|
||||
return;
|
||||
@@ -741,17 +741,16 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
lastDes = newDest;
|
||||
config.lastDes(lastDes.getOption());
|
||||
}
|
||||
else if (event.getOption().equals("Teleport") && event.getTarget().contains("Jewellery Box"))
|
||||
else if (entry.getOption().equals("Teleport") && entry.getTarget().contains("Jewellery Box"))
|
||||
{
|
||||
eventBus.unregister("wait for widget");
|
||||
eventBus.unregister(JEWEL_WIDGET);
|
||||
}
|
||||
else if (lastDes != null &&
|
||||
event.getOpcode() == MenuOpcode.PRIO_RUNELITE.getId() &&
|
||||
event.getOption().equals(lastDes.getOption()))
|
||||
entry.getOpcode() == MenuOpcode.PRIO_RUNELITE.getId() &&
|
||||
entry.getOption().equals(lastDes.getOption()))
|
||||
{
|
||||
MenuEntry e = event.getMenuEntry();
|
||||
e.setOption("Teleport");
|
||||
e.setOpcode(MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId());
|
||||
entry.setOption("Teleport");
|
||||
entry.setOpcode(MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId());
|
||||
|
||||
eventBus.subscribe(ScriptCallbackEvent.class, JEWEL_WIDGET, this::onScriptCallback);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class MiningPlugin extends Plugin
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
//TODO: should work hopefully
|
||||
if (event.getMenuOpcode() != MenuOpcode.RUNELITE || event.getActionParam1() != WidgetInfo.INVENTORY.getId())
|
||||
if (event.getMenuOpcode() != MenuOpcode.RUNELITE || event.getParam1() != WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -377,8 +377,8 @@ public class MotherlodePlugin extends Plugin
|
||||
if (MINE_SPOTS.contains(menu.getIdentifier()) && menu.getMenuOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION)
|
||||
{
|
||||
resetIdleChecks();
|
||||
int veinX = menu.getActionParam0();
|
||||
int veinY = menu.getActionParam1();
|
||||
int veinX = menu.getParam0();
|
||||
int veinY = menu.getParam1();
|
||||
targetVeinLocation = WorldPoint.fromScene(client, veinX, veinY, client.getPlane());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
int type = event.getType();
|
||||
int type = event.getOpcode();
|
||||
|
||||
if (type >= MENU_ACTION_DEPRIORITIZE_OFFSET)
|
||||
{
|
||||
@@ -309,9 +309,9 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
NPC_MENU_ACTIONS.contains(MenuOpcode.of(type)) &&
|
||||
highlightedNpcs.stream().anyMatch(npc -> npc.getIndex() == event.getIdentifier()))
|
||||
{
|
||||
final String target = ColorUtil.prependColorTag(Text.removeTags(event.getMenuEntry().getTarget()), this.getHighlightColor);
|
||||
event.getMenuEntry().setTarget(target);
|
||||
event.setWasModified(true);
|
||||
final String target = ColorUtil.prependColorTag(Text.removeTags(event.getTarget()), this.getHighlightColor);
|
||||
event.setTarget(target);
|
||||
event.setModified(true);
|
||||
}
|
||||
else if (hotKeyPressed && type == MenuOpcode.EXAMINE_NPC.getId())
|
||||
{
|
||||
@@ -321,8 +321,8 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
event.getTarget(),
|
||||
MenuOpcode.RUNELITE.getId(),
|
||||
event.getIdentifier(),
|
||||
event.getActionParam0(),
|
||||
event.getActionParam1(),
|
||||
event.getParam0(),
|
||||
event.getParam1(),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -242,12 +242,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!hotKeyPressed || event.getType() != MenuOpcode.EXAMINE_OBJECT.getId())
|
||||
if (!hotKeyPressed || event.getOpcode() != MenuOpcode.EXAMINE_OBJECT.getId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
|
||||
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getParam0()][event.getParam1()];
|
||||
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||
@@ -255,8 +255,8 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
|
||||
menuEntry.setOption(objects.contains(findTileObject(tile, event.getIdentifier())) ? UNMARK : MARK);
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
menuEntry.setParam0(event.getActionParam0());
|
||||
menuEntry.setParam1(event.getActionParam1());
|
||||
menuEntry.setParam0(event.getParam0());
|
||||
menuEntry.setParam1(event.getParam1());
|
||||
menuEntry.setIdentifier(event.getIdentifier());
|
||||
menuEntry.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
client.setMenuEntries(menuEntries);
|
||||
@@ -272,8 +272,8 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
|
||||
Scene scene = client.getScene();
|
||||
Tile[][][] tiles = scene.getTiles();
|
||||
final int x = event.getActionParam0();
|
||||
final int y = event.getActionParam1();
|
||||
final int x = event.getParam0();
|
||||
final int y = event.getParam1();
|
||||
final int z = client.getPlane();
|
||||
final Tile tile = tiles[z][x][y];
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public class OpponentInfoPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
if (menuEntryAdded.getType() != MenuOpcode.NPC_SECOND_OPTION.getId()
|
||||
if (menuEntryAdded.getOpcode() != MenuOpcode.NPC_SECOND_OPTION.getId()
|
||||
|| !menuEntryAdded.getOption().equals("Attack")
|
||||
|| !config.showOpponentsInMenu())
|
||||
{
|
||||
|
||||
@@ -248,7 +248,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
int type = menuEntryAdded.getType();
|
||||
int type = menuEntryAdded.getOpcode();
|
||||
|
||||
if (type >= 2000)
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ public class PuzzleSolverPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||
{
|
||||
int widgetId = menuOptionClicked.getActionParam1();
|
||||
int widgetId = menuOptionClicked.getParam1();
|
||||
if (TO_GROUP(widgetId) != WidgetID.LIGHT_BOX_GROUP_ID)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SlayermusiqPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
int widgetID = event.getActionParam1();
|
||||
int widgetID = event.getParam1();
|
||||
if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) && "Read Journal:".equals(event.getOption()))
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
@@ -139,8 +139,8 @@ public class SlayermusiqPlugin extends Plugin
|
||||
|
||||
private MenuEntry createSlayermusiqOptionMenuEntry(MenuEntryAdded event)
|
||||
{
|
||||
int widgetIndex = event.getActionParam0();
|
||||
int widgetID = event.getActionParam1();
|
||||
int widgetIndex = event.getParam0();
|
||||
int widgetID = event.getParam1();
|
||||
|
||||
MenuEntry menuEntry = new MenuEntry();
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
|
||||
@@ -389,7 +389,7 @@ public class SuppliesTrackerPlugin extends Plugin
|
||||
{
|
||||
ItemContainer itemContainer = itemContainerChanged.getItemContainer();
|
||||
|
||||
if (itemContainer == client.getItemContainer(InventoryID.INVENTORY) && old != null && !actionStack.isEmpty())
|
||||
if (itemContainer == client.getItemContainer(InventoryID.INVENTORY) && old != null)
|
||||
{
|
||||
while (!actionStack.isEmpty())
|
||||
{
|
||||
@@ -529,10 +529,10 @@ public class SuppliesTrackerPlugin extends Plugin
|
||||
}))
|
||||
{
|
||||
old = client.getItemContainer(InventoryID.INVENTORY);
|
||||
int slot = event.getActionParam0();
|
||||
int slot = event.getParam0();
|
||||
if (old.getItems() != null)
|
||||
{
|
||||
int pushItem = old.getItems()[event.getActionParam0()].getId();
|
||||
int pushItem = old.getItems()[event.getParam0()].getId();
|
||||
MenuAction newAction = new MenuAction.ItemAction(CONSUMABLE, old.getItems(), pushItem, slot);
|
||||
actionStack.push(newAction);
|
||||
}
|
||||
@@ -551,7 +551,7 @@ public class SuppliesTrackerPlugin extends Plugin
|
||||
a.getType() == TELEPORT))
|
||||
{
|
||||
int teleid = event.getIdentifier();
|
||||
MenuAction newAction = new MenuAction.ItemAction(TELEPORT, old.getItems(), teleid, event.getActionParam0());
|
||||
MenuAction newAction = new MenuAction.ItemAction(TELEPORT, old.getItems(), teleid, event.getParam0());
|
||||
actionStack.push(newAction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ public class TimersPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
TeleportWidget teleportWidget = TeleportWidget.of(event.getActionParam1());
|
||||
TeleportWidget teleportWidget = TeleportWidget.of(event.getParam1());
|
||||
if (teleportWidget != null)
|
||||
{
|
||||
lastTeleportClicked = teleportWidget;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class WarIndicatorPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded onMenuEntryAdded)
|
||||
{
|
||||
int type = onMenuEntryAdded.getType();
|
||||
int type = onMenuEntryAdded.getOpcode();
|
||||
|
||||
if (type >= 2000)
|
||||
{
|
||||
|
||||
@@ -252,7 +252,7 @@ public class WikiPlugin extends Plugin
|
||||
}
|
||||
id = lc.getId();
|
||||
name = lc.getName();
|
||||
location = WorldPoint.fromScene(client, ev.getActionParam0(), ev.getActionParam1(), client.getPlane());
|
||||
location = WorldPoint.fromScene(client, ev.getParam0(), ev.getParam1(), client.getPlane());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -334,8 +334,8 @@ public class WikiPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
int widgetIndex = event.getActionParam0();
|
||||
int widgetID = event.getActionParam1();
|
||||
int widgetIndex = event.getParam0();
|
||||
int widgetID = event.getParam1();
|
||||
|
||||
if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) && "Read Journal:".equals(event.getOption()))
|
||||
{
|
||||
|
||||
@@ -390,7 +390,7 @@ public class WorldHopperPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getParam1());
|
||||
String option = event.getOption();
|
||||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId())
|
||||
@@ -433,8 +433,8 @@ public class WorldHopperPlugin extends Plugin
|
||||
hopTo.setOption(HOP_TO);
|
||||
hopTo.setTarget(event.getTarget());
|
||||
hopTo.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
hopTo.setParam0(event.getActionParam0());
|
||||
hopTo.setParam1(event.getActionParam1());
|
||||
hopTo.setParam0(event.getParam0());
|
||||
hopTo.setParam1(event.getParam1());
|
||||
|
||||
insertMenuEntry(hopTo, client.getMenuEntries(), after);
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ public class XpTrackerPlugin extends Plugin
|
||||
|
||||
private void onMenuEntryAdded(final MenuEntryAdded event)
|
||||
{
|
||||
int widgetID = event.getActionParam1();
|
||||
int widgetID = event.getParam1();
|
||||
|
||||
if (TO_GROUP(widgetID) != WidgetID.SKILLS_GROUP_ID
|
||||
|| !event.getOption().startsWith("View")
|
||||
@@ -517,7 +517,7 @@ public class XpTrackerPlugin extends Plugin
|
||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||
menuEntry.setTarget(skillText);
|
||||
menuEntry.setOption(hasOverlay(skill) ? MENUOP_REMOVE_CANVAS_TRACKER : MENUOP_ADD_CANVAS_TRACKER);
|
||||
menuEntry.setParam0(event.getActionParam0());
|
||||
menuEntry.setParam0(event.getParam0());
|
||||
menuEntry.setParam1(widgetID);
|
||||
menuEntry.setOpcode(MenuOpcode.RUNELITE.getId());
|
||||
|
||||
@@ -527,7 +527,7 @@ public class XpTrackerPlugin extends Plugin
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuOpcode().getId() != MenuOpcode.RUNELITE.getId()
|
||||
|| TO_GROUP(event.getActionParam1()) != WidgetID.SKILLS_GROUP_ID)
|
||||
|| TO_GROUP(event.getParam1()) != WidgetID.SKILLS_GROUP_ID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user