There's a few things to address here...
1. Try not to use static IDs, as these could change and it could break the script. Instead use a string literal to retrieve items
if ( getInventory().contains("Logs") ) {}
2. Null check NPCs to avoid NullPointerExceptions, and move interactions to a conditional statement. This is so you can better deal with the success and failure events (true / false).
NPC exchangeClerk = getNpcs().closest("Grand Exchange Clerk");
if ( exchangeClerk != null && exchangeClerk.interact("Exchange") ) {
new ConditionalSleep(MethodProvider.random(2000, 2500)) {
@Override
public boolean condition() throws InterruptedException {
return getGrandExchange().isOpen();
}
}.sleep();
}
3. Avoid while() statements, they are blocking the script onLoop(). The game environment is changing constantly and if the conditional for the while statement is unreachable your script will be unable to proceed. Instead write better conditionals.
---
Spoiler Alert - if you want to use an event to handle this, here is my snippet. As you can see I need to remove the static IDs for Addy and Mith axe, I can do this using an API for the items and dynamically fill item IDs.