events: add tostring/equalsandhashcode to menuoption clicked

This commit is contained in:
Adam
2022-05-23 15:58:48 -04:00
parent 94fc38f05b
commit c64fc72f9e

View File

@@ -24,8 +24,11 @@
*/ */
package net.runelite.api.events; package net.runelite.api.events;
import javax.annotation.Nullable;
import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.ToString;
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;
@@ -42,12 +45,15 @@ import net.runelite.api.widgets.Widget;
* it seems that this event still triggers with the "Cancel" action. * it seems that this event still triggers with the "Cancel" action.
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString(onlyExplicitlyIncluded = true)
public class MenuOptionClicked public class MenuOptionClicked
{ {
/** /**
* The clicked menu entry * The clicked menu entry
*/ */
private final MenuEntry menuEntry; private final MenuEntry menuEntry;
/** /**
* Whether or not the event has been consumed by a subscriber. * Whether or not the event has been consumed by a subscriber.
*/ */
@@ -57,6 +63,8 @@ public class MenuOptionClicked
/** /**
* Action parameter 0. Its value depends on the menuAction. * Action parameter 0. Its value depends on the menuAction.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public int getParam0() public int getParam0()
{ {
return menuEntry.getParam0(); return menuEntry.getParam0();
@@ -65,6 +73,8 @@ public class MenuOptionClicked
/** /**
* Action parameter 1. Its value depends on the menuAction. * Action parameter 1. Its value depends on the menuAction.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public int getParam1() public int getParam1()
{ {
return menuEntry.getParam1(); return menuEntry.getParam1();
@@ -73,6 +83,8 @@ public class MenuOptionClicked
/** /**
* The option text added to the menu. * The option text added to the menu.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public String getMenuOption() public String getMenuOption()
{ {
return menuEntry.getOption(); return menuEntry.getOption();
@@ -81,6 +93,8 @@ public class MenuOptionClicked
/** /**
* The target of the action. * The target of the action.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public String getMenuTarget() public String getMenuTarget()
{ {
return menuEntry.getTarget(); return menuEntry.getTarget();
@@ -89,6 +103,8 @@ public class MenuOptionClicked
/** /**
* The action performed. * The action performed.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public MenuAction getMenuAction() public MenuAction getMenuAction()
{ {
return menuEntry.getType(); return menuEntry.getType();
@@ -97,6 +113,8 @@ public class MenuOptionClicked
/** /**
* The ID of the object, actor, or item that the interaction targets. * The ID of the object, actor, or item that the interaction targets.
*/ */
@EqualsAndHashCode.Include
@ToString.Include
public int getId() public int getId()
{ {
return menuEntry.getIdentifier(); return menuEntry.getIdentifier();
@@ -136,6 +154,7 @@ public class MenuOptionClicked
* with an associated widget. Such as eg, CC_OP. * with an associated widget. Such as eg, CC_OP.
* @return * @return
*/ */
@Nullable
public Widget getWidget() public Widget getWidget()
{ {
return menuEntry.getWidget(); return menuEntry.getWidget();