project: Add a bit of backward compatibility to the reworked menus
This commit is contained in:
@@ -92,4 +92,22 @@ public interface MenuEntry
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
MenuEntry onClick(Consumer<MenuEntry> callback);
|
MenuEntry onClick(Consumer<MenuEntry> callback);
|
||||||
|
|
||||||
|
@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();
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ package net.runelite.api.events;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import net.runelite.api.MenuAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event when a new entry is added to a right-click menu.
|
* An event when a new entry is added to a right-click menu.
|
||||||
@@ -92,4 +93,45 @@ public class MenuEntryAdded
|
|||||||
{
|
{
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getParam0()
|
||||||
|
{
|
||||||
|
return actionParam0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setParam0(int param)
|
||||||
|
{
|
||||||
|
actionParam0 = param;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getParam1()
|
||||||
|
{
|
||||||
|
return actionParam1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setParam1(int param)
|
||||||
|
{
|
||||||
|
actionParam1 = param;
|
||||||
|
}
|
||||||
|
@Deprecated
|
||||||
|
public int getOpcode()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setOpcode(int opcode)
|
||||||
|
{
|
||||||
|
type = opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public MenuAction getMenuAction()
|
||||||
|
{
|
||||||
|
return MenuAction.of(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,28 @@ public class MenuOptionClicked
|
|||||||
this.setParam0(entry.getParam0());
|
this.setParam0(entry.getParam0());
|
||||||
this.setParam1(entry.getParam1());
|
this.setParam1(entry.getParam1());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getActionParam()
|
||||||
|
{
|
||||||
|
return param0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setActionParam(int i)
|
||||||
|
{
|
||||||
|
param0 = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getWidgetId()
|
||||||
|
{
|
||||||
|
return param1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setWidgetId(int i)
|
||||||
|
{
|
||||||
|
param1 = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,4 +163,46 @@ public class TestMenuEntry implements MenuEntry
|
|||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOpcode()
|
||||||
|
{
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOpcode(int opcode)
|
||||||
|
{
|
||||||
|
this.type = opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActionParam0()
|
||||||
|
{
|
||||||
|
return this.param0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActionParam0(int param0)
|
||||||
|
{
|
||||||
|
this.param0 = param0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActionParam1()
|
||||||
|
{
|
||||||
|
return this.param1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActionParam1(int param1)
|
||||||
|
{
|
||||||
|
this.param1 = param1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MenuAction getMenuAction()
|
||||||
|
{
|
||||||
|
return MenuAction.of(this.type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ public class RuneLiteMenuEntry implements MenuEntry
|
|||||||
return MenuAction.of(opcode);
|
return MenuAction.of(opcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MenuAction getMenuAction()
|
||||||
|
{
|
||||||
|
return this.getType();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuEntry setType(MenuAction menuAction)
|
public MenuEntry setType(MenuAction menuAction)
|
||||||
{
|
{
|
||||||
@@ -84,6 +90,31 @@ public class RuneLiteMenuEntry implements MenuEntry
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOpcode()
|
||||||
|
{
|
||||||
|
int opcode = Client.menuOpcodes[this.idx];
|
||||||
|
if (opcode >= 2000)
|
||||||
|
{
|
||||||
|
opcode -= 2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
return opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOpcode(int code)
|
||||||
|
{
|
||||||
|
int opcode = Client.menuOpcodes[this.idx];
|
||||||
|
short mod = 0;
|
||||||
|
if (opcode >= 2000)
|
||||||
|
{
|
||||||
|
mod = 2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client.menuOpcodes[this.idx] = code + mod;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIdentifier()
|
public int getIdentifier()
|
||||||
{
|
{
|
||||||
@@ -110,6 +141,18 @@ public class RuneLiteMenuEntry implements MenuEntry
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActionParam0()
|
||||||
|
{
|
||||||
|
return this.getParam0();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActionParam0(int param0)
|
||||||
|
{
|
||||||
|
this.setParam0(param0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getParam1()
|
public int getParam1()
|
||||||
{
|
{
|
||||||
@@ -123,6 +166,18 @@ public class RuneLiteMenuEntry implements MenuEntry
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActionParam1()
|
||||||
|
{
|
||||||
|
return this.getParam1();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActionParam1(int param1)
|
||||||
|
{
|
||||||
|
this.setParam1(param1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDeprioritized()
|
public boolean isDeprioritized()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user