project(events): Add back some MOC methods

This commit is contained in:
Owain van Brakel
2022-04-20 15:17:08 +02:00
parent d07ac1a358
commit 15603b0ad9
2 changed files with 74 additions and 0 deletions

View File

@@ -122,4 +122,22 @@ public interface MenuEntry
*/ */
@Nullable @Nullable
Widget getWidget(); Widget getWidget();
@Deprecated
int getOpcode();
@Deprecated
void setOpcode(int opcode);
@Deprecated
int getActionParam0();
@Deprecated
void setActionParam0(int param0);
@Deprecated
int getActionParam1();
@Deprecated
void setActionParam1(int param0);
@Deprecated
MenuAction getMenuAction();
} }

View File

@@ -26,6 +26,7 @@ package net.runelite.api.events;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.runelite.api.MenuAction; import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry; import net.runelite.api.MenuEntry;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
@@ -52,6 +53,7 @@ public class MenuOptionClicked
* Whether or not the event has been consumed by a subscriber. * Whether or not the event has been consumed by a subscriber.
*/ */
@Getter @Getter
@Setter
private boolean consumed; private boolean consumed;
/** /**
@@ -62,6 +64,11 @@ public class MenuOptionClicked
return menuEntry.getParam0(); return menuEntry.getParam0();
} }
public void setParam0(int param0)
{
menuEntry.setParam0(param0);
}
/** /**
* Action parameter 1. Its value depends on the menuAction. * Action parameter 1. Its value depends on the menuAction.
*/ */
@@ -70,6 +77,11 @@ public class MenuOptionClicked
return menuEntry.getParam1(); return menuEntry.getParam1();
} }
public void setParam1(int param1)
{
menuEntry.setParam1(param1);
}
/** /**
* The option text added to the menu. * The option text added to the menu.
*/ */
@@ -78,6 +90,11 @@ public class MenuOptionClicked
return menuEntry.getOption(); return menuEntry.getOption();
} }
public void setMenuOption(String menuOption)
{
menuEntry.setOption(menuOption);
}
/** /**
* The target of the action. * The target of the action.
*/ */
@@ -86,6 +103,11 @@ public class MenuOptionClicked
return menuEntry.getTarget(); return menuEntry.getTarget();
} }
public void setMenuTarget(String menuTarget)
{
menuEntry.setOption(menuTarget);
}
/** /**
* The action performed. * The action performed.
*/ */
@@ -94,6 +116,11 @@ public class MenuOptionClicked
return menuEntry.getType(); return menuEntry.getType();
} }
public void setMenuAction(MenuAction menuAction)
{
menuEntry.setType(menuAction);
}
/** /**
* The ID of the object, actor, or item that the interaction targets. * The ID of the object, actor, or item that the interaction targets.
*/ */
@@ -102,6 +129,11 @@ public class MenuOptionClicked
return menuEntry.getIdentifier(); return menuEntry.getIdentifier();
} }
public void setId(int id)
{
menuEntry.setIdentifier(id);
}
/** /**
* Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops. * Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.
* @return * @return
@@ -159,9 +191,33 @@ public class MenuOptionClicked
return menuEntry.getParam0(); return menuEntry.getParam0();
} }
@Deprecated
public void setActionParam(int actionParam)
{
menuEntry.setParam0(actionParam);
}
@Deprecated @Deprecated
public int getWidgetId() public int getWidgetId()
{ {
return menuEntry.getParam1(); return menuEntry.getParam1();
} }
@Deprecated
public void setWidgetId(int widgetId)
{
menuEntry.setParam1(widgetId);
}
@Deprecated
public void setMenuEntry(MenuEntry entry)
{
this.setMenuOption(entry.getOption());
this.setMenuTarget(entry.getTarget());
this.setId(entry.getIdentifier());
this.setMenuAction(entry.getType());
this.setParam0(entry.getParam0());
this.setParam1(entry.getParam1());
}
} }