But all the silver, and gold, and vessels of brass and iron, are holy to Yahweh: they shall come into the treasury of Yahweh.
Now how did Joshua know that? It didn't happen for several hundred years, but you will read in first Kings, the sixteenth chapter, and the thirty-fourth verse where the king decided to rebuild the city of Jericho, and they started building it in the time of his firstborn son. Then when his youngest son was born, they set the gate of the city of Jericho. The prophecy here of Joshua was literally fulfilled. The man was cursed also, so the whole prophecy was fulfilled. "