script keeps getting stuck on a if(closestObject(9345) != null) the object is a bird snare and it is on the ground when it cycles through to the null check but it never gets passed. I've tried using closestNPC(), closestObjectForName(), ClosestNPCForName() all dont make it passed the null check.
public void LaySnare() throws InterruptedException {
Inventory Inven = client.getInventory();
final RS2Object GroundSnare = closestObject(9345);
final Entity player = client.getMyPlayer();
if (player != null)
if (HuntingGround.contains(player)) {
if (Inven.contains(BirdSnareItem) == true) {
Inven.interactWithName(BirdSnareItem, InteractSnare);
sleep(10000);
if(GroundSnare != null){
log("logging snare position");
snare = GroundSnare.getPosition();
if(!Inven.contains(BirdSnareItem)){
log(DetectState);
StateHolder = 0;}
}
}
} else {
walkExact(HuntingGround);
}
}