donaldchen34 Posted November 9, 2018 Share Posted November 9, 2018 Not sure if this works for a amulet of glory check as it was working earlier but for some reason isnt now. Spoiler public final String[] amuletOfGlory = {"Amulet of glory(6)", "Amulet of glory(5)", "Amulet of glory(4)", "Amulet of glory(3)", "Amulet of glory(2)", "Amulet of glory(1)" }; public void checkGlory() throws InterruptedException { if (!getEquipment().isWearingItem(EquipmentSlot.AMULET, String.valueOf(amuletOfGlory))) { if (getEquipment().isWearingItem(EquipmentSlot.AMULET)) { getEquipment().unequip(EquipmentSlot.AMULET); } else { if (!getInventory().contains("Amulet of glory(6)")) { if (!getBank().isOpen()) { bank(); getBank().withdraw("Amulet of glory(6)", 1); getBank().close(); } } else { getInventory().interact("Wear", "Amulet of glory(6)"); } } } else { bank(); } } private void bank() throws InterruptedException { getBank().open(); getBank().depositAll(); } Quote Link to comment Share on other sites More sharing options...
Juggles Posted November 10, 2018 Share Posted November 10, 2018 (edited) Use a lambda expression instead. Edited November 10, 2018 by Juggles Quote Link to comment Share on other sites More sharing options...
donaldchen34 Posted November 10, 2018 Author Share Posted November 10, 2018 (edited) 38 minutes ago, Juggles said: Use a lambda expression instead. I use the string in a different class too should i change both of them to lamdas does the expression not work with the string Edited November 10, 2018 by donaldchen34 Quote Link to comment Share on other sites More sharing options...
Juggles Posted November 10, 2018 Share Posted November 10, 2018 11 minutes ago, donaldchen34 said: I use the string in a different class too should i change both of them to lamdas does the expression not work with the string I would just do !getEquipment().contains(f->f.getName.contains("Amulet of glory(") { 1 Quote Link to comment Share on other sites More sharing options...
donaldchen34 Posted November 10, 2018 Author Share Posted November 10, 2018 9 minutes ago, Juggles said: I would just do !getEquipment().contains(f->f.getName.contains("Amulet of glory(") { Didnt even think about including the ( after the glory Quote Link to comment Share on other sites More sharing options...
FrostBug Posted November 12, 2018 Share Posted November 12, 2018 On 11/10/2018 at 12:01 AM, donaldchen34 said: Not sure if this works for a amulet of glory check as it was working earlier but for some reason isnt now. Hide contents public final String[] amuletOfGlory = {"Amulet of glory(6)", "Amulet of glory(5)", "Amulet of glory(4)", "Amulet of glory(3)", "Amulet of glory(2)", "Amulet of glory(1)" }; public void checkGlory() throws InterruptedException { if (!getEquipment().isWearingItem(EquipmentSlot.AMULET, String.valueOf(amuletOfGlory))) { if (getEquipment().isWearingItem(EquipmentSlot.AMULET)) { getEquipment().unequip(EquipmentSlot.AMULET); } else { if (!getInventory().contains("Amulet of glory(6)")) { if (!getBank().isOpen()) { bank(); getBank().withdraw("Amulet of glory(6)", 1); getBank().close(); } } else { getInventory().interact("Wear", "Amulet of glory(6)"); } } } else { bank(); } } private void bank() throws InterruptedException { getBank().open(); getBank().depositAll(); } String.valueOf(amuletOfGlory) ^ This does not do what you seem to think it does Instead, do: if (!getEquipment().isWearingItemThatContains(EquipmentSlot.AMULET, amuletOfGlory))) { Quote Link to comment Share on other sites More sharing options...