Package net.runelite.api
Interface MenuEntry
-
public interface MenuEntry
A menu entry in a right-click menu.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Menu
createSubMenu()
Create a new submenu for this menu entry.void
deleteSubMenu()
Remove the submenu from this menu entry.Actor
getActor()
Get theActor
this menu entry is targeting, if any.int
getIdentifier()
An identifier value for the target of the action.int
getItemId()
Get the item idint
getItemOp()
If this menu entry is an item op, get the item op idNPC
getNpc()
Get theNPC
this menu entry is targeting, if any.String
getOption()
The option text added to the menu.int
getParam0()
An additional parameter for the action.int
getParam1()
A second additional parameter for the action.Player
getPlayer()
Get thePlayer
this menu entry is targeting, if any.Menu
getSubMenu()
Get the submenu for this menu entry.String
getTarget()
The target of the action.MenuAction
getType()
The action the entry will trigger.Widget
getWidget()
Get the widget this menu entry is on, if this is a menu entry with an associated widget.int
getWorldViewId()
boolean
isDeprioritized()
Deprioritized menus are sorted in the menu to be below the other menu entries.boolean
isForceLeftClick()
If this is true and you have single mouse button on and this entry is the top entry the right click menu will not be opened when you left click This is used for shift clickboolean
isItemOp()
Test if this menu entry is an item op.Consumer<MenuEntry>
onClick()
Get the callback called when the menu option is clickedMenuEntry
onClick(Consumer<MenuEntry> callback)
Set a callback to be called when this menu option is clickedMenuEntry
setDeprioritized(boolean deprioritized)
MenuEntry
setForceLeftClick(boolean forceLeftClick)
MenuEntry
setIdentifier(int identifier)
MenuEntry
setItemId(int itemId)
Set the item idMenuEntry
setOption(String option)
MenuEntry
setParam0(int param0)
MenuEntry
setParam1(int param1)
MenuEntry
setTarget(String target)
MenuEntry
setType(MenuAction type)
MenuEntry
setWorldViewId(int worldViewId)
-
-
-
Method Detail
-
getOption
String getOption()
The option text added to the menu. (ie. "Walk here", "Use")
-
getTarget
String getTarget()
The target of the action. (ie. Item or Actor name)If the option does not apply to any target, this field will be set to empty string.
-
getIdentifier
int getIdentifier()
An identifier value for the target of the action.
-
setIdentifier
MenuEntry setIdentifier(int identifier)
-
getType
MenuAction getType()
The action the entry will trigger.
-
setType
MenuEntry setType(MenuAction type)
-
getParam0
int getParam0()
An additional parameter for the action.
-
setParam0
MenuEntry setParam0(int param0)
-
getParam1
int getParam1()
A second additional parameter for the action.
-
setParam1
MenuEntry setParam1(int param1)
-
isForceLeftClick
boolean isForceLeftClick()
If this is true and you have single mouse button on and this entry is the top entry the right click menu will not be opened when you left click This is used for shift click
-
setForceLeftClick
MenuEntry setForceLeftClick(boolean forceLeftClick)
-
getWorldViewId
int getWorldViewId()
-
setWorldViewId
MenuEntry setWorldViewId(int worldViewId)
-
isDeprioritized
boolean isDeprioritized()
Deprioritized menus are sorted in the menu to be below the other menu entries.- Returns:
-
setDeprioritized
MenuEntry setDeprioritized(boolean deprioritized)
-
onClick
MenuEntry onClick(Consumer<MenuEntry> callback)
Set a callback to be called when this menu option is clicked- Parameters:
callback
-- Returns:
-
onClick
Consumer<MenuEntry> onClick()
Get the callback called when the menu option is clicked- Returns:
-
isItemOp
boolean isItemOp()
Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.- Returns:
-
getItemOp
int getItemOp()
If this menu entry is an item op, get the item op id- Returns:
- 1-5
-
getItemId
int getItemId()
Get the item id- Returns:
- See Also:
ItemID
,NullItemID
-
setItemId
MenuEntry setItemId(int itemId)
Set the item id- Parameters:
itemId
-- Returns:
-
getWidget
@Nullable Widget getWidget()
Get the widget this menu entry is on, if this is a menu entry with an associated widget. Such as eg, CC_OP.- Returns:
-
getPlayer
@Nullable Player getPlayer()
Get thePlayer
this menu entry is targeting, if any.- Returns:
-
getSubMenu
@Nullable Menu getSubMenu()
Get the submenu for this menu entry.- Returns:
- the submenu, or null if one doesn't exist
- See Also:
createSubMenu()
-
createSubMenu
@Nonnull Menu createSubMenu()
Create a new submenu for this menu entry. This will erase any previous submenu.- Returns:
- the new submenu
-
deleteSubMenu
void deleteSubMenu()
Remove the submenu from this menu entry.
-
-