public boolean usePleb(String action, String action2) { // action == the item it is going to select, action2 == in this case, is the ruins
Entity ruins = objects.closest(action2);
if (inventory.isItemSelected()) { // IF ITEM IS SELECTED
if (inventory.getSelectedItemName() == action) { // IF THE SELECTED ITEM IS == action
ruins.interact("Use");
} else {
inventory.deselectItem();
}
} else {
inventory.interact("Use", action); // THIS ONE WILL SELECT THE ITEM IF ITEM IS NOT SELECTED
}
return true;
}
to use this just use;
usePleb("Air talisman", "Mysterious Ruins");