api: pass menu entry to menu clicked event and forward accessors

This commit is contained in:
Adam
2022-04-16 16:28:38 -04:00
parent 802f8c654a
commit fcb933eeef
4 changed files with 75 additions and 36 deletions

View File

@@ -286,7 +286,7 @@ public class CannonPlugin extends Plugin
// Check if cannonballs are being used on the cannon
if (event.getMenuAction() == MenuAction.ITEM_USE_ON_GAME_OBJECT)
{
final int idx = event.getSelectedItemIndex();
final int idx = client.getSelectedItemIndex();
final ItemContainer items = client.getItemContainer(InventoryID.INVENTORY);
if (items == null)
{

View File

@@ -703,7 +703,7 @@ public class GroundItemsPlugin extends Plugin
return;
}
final Item clickedItem = inventory.getItem(menuOptionClicked.getSelectedItemIndex());
final Item clickedItem = inventory.getItem(client.getSelectedItemIndex());
if (clickedItem == null)
{
return;