Minecraft combining /testfor names and enchants in one command? [duplicate]
so I made this command to test for if a player has a $50 dollar check on my minecraft server so i can then link that up to a command that will clear the check and pay them. My issue is I can't seem to figure out how to add an enchant to the command. The checks are all enchanted with Unbreaking 10 but I can't seem to figure out how to add that constraint in the command. The command (so far) is:
/testfor @p {Inventory:[{id:"minecraft:paper",tag:{display:{Name:"$50 Check"}}}]}
If anyone would be willing to help me add an enchant constrain so players can't just use anvils to forge checks that would be awesome. (It is a 1.12.2 server btw)
EDIT This question has changed to combining my command
/testfor @p {Inventory:[{id:"minecraft:paper",tag:{display:{Name:"$50 Check"}}}]}
and the enchantment constraint, [{id:34s,lvl:10s}
. If someone could help me I've searched to try to find how to do this but I really can't find a way that works.
Solution 1:
The enchantment section goes inside the tag section after display.
Here is the setup minus the information and spaced out:
/testfor @p {Inventory:[{ id:"...", tag:{ display:{...}, ench:[...] }}]}
Here is the final command:
/testfor @p {Inventory:[{id:"minecraft:paper",tag:{display:{Name:"$50 Check"},ench:[{id:34s,lvl:10s}]}}]}
A warning, duplication glitches are discovered often, when using an item based currency form like this, the items can be easily duplicated which then ruins the economy. I strongly recommend using a scoreboard based currency instead. Here is a question which, the question itself, provides a lot of good information on scoreboard shop.