The window villagers trade in, with offers of your own:
command /blacksmith:
players only: true
trigger:
open trades "&6Blacksmith":
5 emerald for 1 iron sword
8 emerald and 1 stick for 1 diamond sword named "&bFrostbite" enchanted with sharpness 2
1 diamond for 12 emerald
Written
Meaning
open trades <title>:
Opens the trading window for the player; open trades <title> for <who>: for someone else. The lines under it are the offers
<cost> for <result>
An offer: what is paid on the left, what is got on the right. Any item with its amount, name and enchantments, or one named with item <name>:
<cost> and <cost> for <result>
An offer that takes two things
The game does the trading itself: it checks that the player has what an offer costs, takes it and hands over the result, as with a villager. Nothing has to be scripted for that.
An offer can be used as often as the player can pay. A script that wants to sell something only once gives it out with give instead.
Money from an economy plugin cannot be an offer's cost: offers are item for item. Sell for money from a menu, with balance of player.