Merge remote-tracking branch 'db/re-enable-hop'
This commit is contained in:
@@ -72,6 +72,7 @@ import net.runelite.client.chat.QueuedMessage;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.input.KeyManager;
|
import net.runelite.client.input.KeyManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.util.HotkeyListener;
|
import net.runelite.client.util.HotkeyListener;
|
||||||
@@ -83,10 +84,10 @@ import net.runelite.http.api.worlds.WorldResult;
|
|||||||
import net.runelite.http.api.worlds.WorldType;
|
import net.runelite.http.api.worlds.WorldType;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
//@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
// name = "World Hopper",
|
name = "World Hopper",
|
||||||
// description = "Allows you to quickly hop worlds"
|
description = "Allows you to quickly hop worlds"
|
||||||
//)
|
)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WorldHopperPlugin extends Plugin
|
public class WorldHopperPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@@ -101,8 +102,6 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
private static final ImmutableList<String> BEFORE_OPTIONS = ImmutableList.of("Add friend", "Remove friend", KICK_OPTION);
|
private static final ImmutableList<String> BEFORE_OPTIONS = ImmutableList.of("Add friend", "Remove friend", KICK_OPTION);
|
||||||
private static final ImmutableList<String> AFTER_OPTIONS = ImmutableList.of("Message");
|
private static final ImmutableList<String> AFTER_OPTIONS = ImmutableList.of("Message");
|
||||||
|
|
||||||
private static final ImmutableList<String> BEFORE_OPTIONS_CHAT = ImmutableList.of("Report");
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -292,8 +291,7 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||||
String option = event.getOption();
|
String option = event.getOption();
|
||||||
|
|
||||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId() ||
|
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId())
|
||||||
groupId == WidgetInfo.PRIVATE_CHAT_MESSAGE.getGroupId())
|
|
||||||
{
|
{
|
||||||
boolean after;
|
boolean after;
|
||||||
|
|
||||||
@@ -327,30 +325,6 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
|
|
||||||
insertMenuEntry(hopTo, client.getMenuEntries(), after);
|
insertMenuEntry(hopTo, client.getMenuEntries(), after);
|
||||||
}
|
}
|
||||||
else if (groupId == WidgetInfo.CHATBOX.getGroupId())
|
|
||||||
{
|
|
||||||
if (!BEFORE_OPTIONS_CHAT.contains(option))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't add entry if user is offline
|
|
||||||
ChatPlayer player = getChatPlayerFromName(event.getTarget());
|
|
||||||
|
|
||||||
if (player == null || player.getWorld() == 0 || player.getWorld() == client.getWorld())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final MenuEntry hopTo = new MenuEntry();
|
|
||||||
hopTo.setOption(HOP_TO);
|
|
||||||
hopTo.setTarget(event.getTarget());
|
|
||||||
hopTo.setType(MenuAction.RUNELITE.getId());
|
|
||||||
hopTo.setParam0(event.getActionParam0());
|
|
||||||
hopTo.setParam1(event.getActionParam1());
|
|
||||||
|
|
||||||
insertMenuEntry(hopTo, client.getMenuEntries(), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries, boolean after)
|
private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries, boolean after)
|
||||||
|
|||||||
Reference in New Issue
Block a user