Without brackets around your code block after the while loop it will only use the next line ^^
So it makes a lot of sense actually ;)
Other things I see in here:
- Stop using while loops, Use the onLoop properly instead. (Basicly the onLoop is already a while loop you need)
- Stop using interactable or Entity classes, use RS2Object instead to get the Tree.
- Why are you saving the animation in a boolean? Could just put the animation check inside the statement. Saves you some memory
- if(action == true) can just be if(action)
There is still room for a lot of improvements here, try to read some book about java and you'll understand it way way better.