project: Implement the new menu entry handling

This commit is contained in:
Owain van Brakel
2021-12-16 09:45:44 +01:00
parent 7ef3e6b980
commit a42c845ad3
35 changed files with 665 additions and 402 deletions

View File

@@ -142,9 +142,7 @@ public class MenuManager
.setTarget(currentMenu.getMenuTarget())
.setType(MenuAction.RUNELITE)
.setParam1(widgetId)
.onClick(currentMenu.callback)
// TODO: remove
.add(client);
.onClick(currentMenu.callback);
}
}

View File

@@ -362,9 +362,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
.setOption(text)
.setType(MenuAction.RUNELITE)
.setIdentifier(event.getIdentifier())
.onClick(this::editTags)
// TODO: remove
.add(client);
.onClick(this::editTags);
}
tabInterface.handleAdd(event);

View File

@@ -1196,8 +1196,6 @@ public class TabInterface
.setTarget(target)
.setOption(option)
.setType(MenuAction.RUNELITE)
.setIdentifier(event.getIdentifier())
// TODO: remove
.add(client);
.setIdentifier(event.getIdentifier());
}
}

View File

@@ -242,9 +242,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
{
final StringSelection stringSelection = new StringSelection(Text.removeTags(currentMessage));
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
})
// TODO: remove
.add(client);
});
}
@Subscribe
@@ -290,9 +288,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
}
optionBuilder.append(CLEAR_HISTORY);
clearEntry.setOption(optionBuilder.toString())
// TODO: remove
.add(client);
clearEntry.setOption(optionBuilder.toString());
}
private void clearMessageQueue(ChatboxTab tab)

View File

@@ -185,9 +185,7 @@ public class FriendListPlugin extends Plugin
.type(ChatMessageType.CONSOLE)
.value("Login notifications for " + friend + " are now " + (hidden ? "shown." : "hidden."))
.build());
})
// TODO: remove
.add(client);
});
}
}

View File

@@ -266,9 +266,7 @@ public class FriendNotesPlugin extends Plugin
log.debug("Set note for '{}': '{}'", sanitizedTarget, content);
setFriendNote(sanitizedTarget, content);
}).build();
})
// TODO: remove
.add(client);
});
}
else if (hoveredFriend != null)
{

View File

@@ -251,9 +251,7 @@ public class GroundMarkerPlugin extends Plugin
{
markTile(target.getLocalLocation());
}
})
// TODO: remove
.add(client);
});
if (exists)
{
@@ -268,9 +266,7 @@ public class GroundMarkerPlugin extends Plugin
{
labelTile(target);
}
})
// TODO: remove
.add(client);
});
}
}
}

View File

@@ -178,9 +178,7 @@ public class HiscorePlugin extends Plugin
HiscoreEndpoint endpoint = findHiscoreEndpointFromPlayerName(e.getTarget());
String target = Text.removeTags(e.getTarget());
lookupPlayer(target, endpoint);
})
// TODO: remove
.add(client);
});
}
}

View File

@@ -198,9 +198,7 @@ public class InventoryTagsPlugin extends Plugin
{
unsetTag(itemId);
}
})
// TODO: remove
.add(client);
});
}
}
}

View File

@@ -598,9 +598,7 @@ public class MenuEntrySwapperPlugin extends Plugin
.setOption(RESET)
.setTarget(configuringShiftClick ? SHIFT_CLICK_MENU_TARGET : LEFT_CLICK_MENU_TARGET)
.setType(MenuAction.RUNELITE)
.onClick(e -> unsetSwapConfig(configuringShiftClick, itemId))
// TODO: remove
.add(client);
.onClick(e -> unsetSwapConfig(configuringShiftClick, itemId));
}
@Subscribe

View File

@@ -296,19 +296,15 @@ public class NpcIndicatorsPlugin extends Plugin
.setTarget(event.getTarget())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::tag)
// TODO: remove
.add(client);
.onClick(this::tag);
}
client.createMenuEntry(-1)
MenuEntry i = client.createMenuEntry(-1)
.setOption(npcTags.contains(npc.getIndex()) ? UNTAG : TAG)
.setTarget(event.getTarget())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::tag)
// TODO: remove
.add(client);
.onClick(this::tag);
}
}

View File

@@ -235,9 +235,7 @@ public class ObjectIndicatorsPlugin extends Plugin
.setParam1(event.getActionParam1())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::markObject)
// TODO: remove
.add(client);
.onClick(this::markObject);
}
private void markObject(MenuEntry entry)

View File

@@ -418,9 +418,7 @@ public class WikiPlugin extends Plugin
.addPathSegment("w")
.addPathSegment(Text.removeTags(ev.getTarget()))
.addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE)
.build().toString()))
// TODO: remove
.add(client);
.build().toString()));
}
}
}

View File

@@ -405,9 +405,7 @@ public class WorldHopperPlugin extends Plugin
{
hop(p.getWorld());
}
})
// TODO: remove
.add(client);
});
}
}

View File

@@ -532,9 +532,7 @@ public class XpTrackerPlugin extends Plugin
{
addOverlay(skill);
}
})
// TODO: remove
.add(client);
});
}
XpStateSingle getSkillState(Skill skill)

View File

@@ -185,9 +185,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
.setOption(overlayMenuEntry.getOption())
.setTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET))
.setType(overlayMenuEntry.getMenuAction())
.onClick(e -> eventBus.post(new OverlayMenuClicked(overlayMenuEntry, overlay)))
// TODO: remove
.add(client);
.onClick(e -> eventBus.post(new OverlayMenuClicked(overlayMenuEntry, overlay)));
}
}

View File

@@ -114,9 +114,7 @@ public class WorldMapOverlay extends Overlay
.setOption(FOCUS_ON)
.setType(MenuAction.RUNELITE)
.onClick(m -> client.getRenderOverview().setWorldMapPositionTarget(
MoreObjects.firstNonNull(worldPoint.getTarget(), worldPoint.getWorldPoint())))
// TODO: remove
.add(client);
MoreObjects.firstNonNull(worldPoint.getTarget(), worldPoint.getWorldPoint())));
});
bottomBar.setHasListener(true);

View File

@@ -30,7 +30,7 @@ import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
@EqualsAndHashCode(callSuper = false)
public class TestMenuEntry extends MenuEntry
public class TestMenuEntry implements MenuEntry
{
private String option;
private String target;