api/client: various (MenuEntry api stuff, agility/translate plugin stuff to use that) (#1748)

* Standardize MenuEntry methods, make MenuEntry events extend MenuEntry

* Make agility plugin only change entries it needs to

* Clean up chat translator by a lot, also implement cloneable instead of just adding a ranodm copy method smh

* actions: allow slash in PR title

* devtools: Fix checkstyle

* examineplugin: Fix tests
This commit is contained in:
Lucwousin
2019-10-11 12:05:45 +02:00
committed by Kyle
parent 537eb29538
commit 85f266c181
41 changed files with 507 additions and 480 deletions

View File

@@ -24,17 +24,15 @@
*/
package net.runelite.api;
import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* A menu entry in a right-click menu.
*/
@Data
@NoArgsConstructor
public class MenuEntry
public class MenuEntry implements Cloneable
{
/**
* The option text added to the menu (ie. "Walk here", "Use").
@@ -46,7 +44,6 @@ public class MenuEntry
* If the option does not apply to any target, this field
* will be set to empty string.
*/
@Setter(AccessLevel.NONE)
private String target;
/**
* An identifier value for the target of the action.
@@ -84,21 +81,24 @@ public class MenuEntry
this.forceLeftClick = forceLeftClick;
}
public static MenuEntry copy(MenuEntry src)
@Override
public MenuEntry clone()
{
return new MenuEntry(
src.getOption(),
src.getTarget(),
src.getIdentifier(),
src.getOpcode(),
src.getParam0(),
src.getParam1(),
src.isForceLeftClick()
);
try
{
return (MenuEntry) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
}
public void setTarget(String target)
/**
* Get opcode, but as it's enum counterpart
*/
public MenuOpcode getMenuOpcode()
{
this.target = target;
return MenuOpcode.of(getOpcode());
}
}