Right so enter the position and this code should work for you. This uses this sleep class:
Position shop = new Position(###,###,###);
if (myPlayer().getPosition().distance(shop) > 10) {
WebWalkEvent event = new WebWalkEvent(shop);
execute(event);
}
NPC ShopKeeper = npcs.closest("Shop keeper");
if (ShopKeeper.exists()) {
if (ShopKeeper.isVisible()) {
if (!store.isOpen()) {
ShopKeeper.interact("Trade");
Sleep.sleepUntil(() -> store.isOpen(), 5000);
}
}
}
if (store.isOpen()) {
if (!inventory.contains("Spade")) {
Sleep.sleepUntil(() -> store.buy("Spade", 5), 5000);
}
}