-1

I'm making an enchanting shop, where you click a button, it takes away your sword, gives you an enchanted one. But currently, I am using /clear to take away the sword, so if someone has more swords, it takes away all of them. How do I do this? Do you have to add a number somewhere? I am not trying to take away items with custom names, just a normal diamond sword.

1
1

The syntax of /clear is:

/clear [player] [item] [data] [maxCount] [dataTag]

To make it only take away one sword, put maxCount as 1.

Not the answer you're looking for? Browse other questions tagged or ask your own question.