Minecraft – Why does the villager not accept the trade commands

minecraft-commandsminecraft-java-edition

I created a villager with custom trades using the following commands:

/summon villager ~ ~ ~ {CustomNameVisible:1b,CustomName:'{"text":"Alex"}',VillagerData:{level:99,profession:"minecraft:cartographer",type:"minecraft:plains"},Offers:{Recipes:[{maxUses:99999999,buy:{id:"minecraft:paper",Count:1b,tag:{display:{Name:'{"text":"Alex´s Special Money","color":"dark_green","italic":false}',Lore:['{"text":"Money Created by Alex","color":"dark_gray","italic":false}']},HideFlags:63}},sell:{id:"minecraft:diamond_pickaxe",Count:1b,tag:{display:{Name:'{"text":"STONNKS","color":"gold","italic":false}',Lore:['{"text":"NUB","color":"dark_gray","italic":false}']},HideFlags:62,RepairCost:0,Unbreakable:1b,Enchantments:[{id:"minecraft:fortune",lvl:3s}]}}}]}}

enter image description here

enter image description here

then i made the first item as a give command :

/minecraft:give @p paper{display:{Name:'{"text":"Alex´s Special Money","color":"dark_green","italic":false}',Lore:['{"text":"Money Created by Alex","color":"dark_gray","italic":false}']},HideFlags:63} 1

but when I try to trade, nothing happens. Help?

Best Answer

(Due to not being able to tell what version this is focused on, I will assume that this is 1.13+ due to how the trader command has the new 1.13 formatting. However, I did my testing in 1.14, so things may vary between versions)

Your /give command and your trader command seem fine, although you seem to have put "/minecraft:give" at the beginning of the command rather than the correct formatting (/give). By changing this tidbit in front of the command to be able to function properly, the command then completely works fine. An image showing that the command works after fixing the "/give" part (1.14)

I tried trading with the villager that was spawned with the first command you put, and it seems to be working perfectly fine. Looking through the /give command, the paper item also has exactly-matching NBT.

Given that the two pictures you attached also look nearly or actually are identical, I would assume that you just didn't have the paper item in your inventory, meaning you couldn't trade with the trader. An image showing that the custom-NBT paper is working.

However, if it's still not working, it might be easier/better to use a combination of two plugins to be able to make custom trader shops that sell customized items: one being a plugin to customize items, and another being a plugin that will let you easily create custom shopkeepers.

For customizing items, I would highly recommend giving Item Editor or Simple Rename a try (Item Editor is GUI-based and has more features, while Simple Rename is chat-command based and is a bit simpler). For shopkeeper creation, one of the best plugins out there is the Shopkeepers plugin, which allows you to drag items from your inventory into a GUI to create a shopkeeper that sells the items. You can also set the shopkeepers to be different mobs and customize their settings (to an extent), which is a nice bonus. Not only that, but this plugin will basically mean you won't have to manually create the commands to summon these traders in.

As far as I know, the 3 plugins I mentioned should work on most or all servers, and are also free to use. I've linked them below this line of text.

Item Editor - (1.7-1.15): https://www.spigotmc.org/resources/item-editor.27637/

Simple Rename - (1.8-1.15): https://www.spigotmc.org/resources/simple-rename.16220/

Shopkeepers - (1.14-1.16): https://dev.bukkit.org/projects/shopkeepers

TL;DR: Replace "/minecraft:give" in the /give command to "/give" in order to receive the correct-NBT paper item and trade with the trader correctly.