sinclair666 Posted November 15, 2019 Share Posted November 15, 2019 I'm missing something silly and can't figure it out. Right now I'm using NPC fishingSpot = npcs.closest(o -> o.getName().contains("Fishing spot")); and its super obvious when all the bots switch to the closest fishing spot at the same time. So I'm trying to switch my script to ignore which fishing spot is closest and just pick any of the ones it can find. I checked the API documentation and I thought I could use npcs.getAll() but when I try NPC fishingSpot = getNpcs().getAll().filter(new NameFilter("Fishing spot")); and NPC fishingSpot = npcs.getAll().filter(new NameFilter("Fishing spot")); the editor is giving me an error on the ".filter" portion. I'm definitely using getAll() wrong but I'm not sure how to fix it. Quote Link to comment Share on other sites More sharing options...
Gunman Posted November 16, 2019 Share Posted November 16, 2019 (edited) @sinclair666 Only thing I can think of at the moment since I am tired but should work. First you can grab the closest fishing spot like I did below then grab the position and tell it the fishing spot you want is != to the second closest fishing spot's position. NPC closestfishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot")); NPC fishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot") && npc.getPosition() != closestfishingSpot.getPosition()); EDIT 1 : Hold up I just had an idea and need a sec to test if it would work. EDIT 2 : Nope nvm brian.exe stopped working and couldn't finish the thought sorry. Edited November 16, 2019 by Gunman Quote Link to comment Share on other sites More sharing options...
FuryShark Posted November 16, 2019 Share Posted November 16, 2019 (edited) List<NPC> fishingSpots = getNpcs().filter(new NameFilter<>("Fishing spot")); Edited November 16, 2019 by FuryShark Quote Link to comment Share on other sites More sharing options...
sinclair666 Posted November 16, 2019 Author Share Posted November 16, 2019 1 hour ago, Gunman said: @sinclair666 Only thing I can think of at the moment since I am tired but should work. First you can grab the closest fishing spot like I did below then grab the position and tell it the fishing spot you want is != to the second closest fishing spot's position. NPC closestfishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot")); NPC fishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot") && npc.getPosition() != closestfishingSpot.getPosition()); EDIT 1 : Hold up I just had an idea and need a sec to test if it would work. EDIT 2 : Nope nvm brian.exe stopped working and couldn't finish the thought sorry. Thanks 1 hour ago, FuryShark said: List<NPC> fishingSpots = getNpcs().filter(new NameFilter<>("Fishing spot")); Couldn't seem to get this working, the IDE is highlighting <NPC> and giving the error "Type java.awt.list does not have type parameters" Quote Link to comment Share on other sites More sharing options...
FuryShark Posted November 16, 2019 Share Posted November 16, 2019 18 minutes ago, sinclair666 said: Couldn't seem to get this working, the IDE is highlighting <NPC> and giving the error "Type java.awt.list does not have type parameters" import java.util.List instead of java.awt.List; Quote Link to comment Share on other sites More sharing options...
sinclair666 Posted November 16, 2019 Author Share Posted November 16, 2019 10 minutes ago, FuryShark said: import java.util.List instead of java.awt.List; Thanks! its working now Quote Link to comment Share on other sites More sharing options...