Does this help you buddy?
@ScriptManifest(author = "FFTL", info = "First", name = "main", version = 1.0, logo = "")
public class FFTLFeathers extends Script {
private State state;
public enum State {
LOOTING, WALKING, FILLTHISINMAN
}
@Override
public int onLoop() throws InterruptedException {
getState();
switch (state) {
case LOOTING:
lootFeather();
break;
}
return 750;
}
private void getState() {
final GroundItem feather = closestGroundItemForName("Feather");
if (feather != null) {
if (feather.isVisible()) {
state = State.LOOTING;
}
}
}
public void lootFeather() {
GroundItem feather = closestGroundItemForName("Feather");
if (feather != null)
feather.interact("Take");
}
private GroundItem closestGroundItemForName(final String name) {
final GroundItems groundItems = new GroundItems();
final List<GroundItem> list = groundItems.filter(new NameFilter<>(name));
for (GroundItem g : list) {
if (g.isOnScreen() && g.exists()) { //You could implement a null-check here
return g;
}
}
return null;
}
}
Edit: not so familiar with the API yet, let me know if there are better ways lol.